Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Very few people have the skill to turn a div into an effective button, yet over and over I see web sites with rows of buttons which are in fact just divs with javascript behind them.

I created a minimalist CSS framework called Neat CSS (https://neat.joeldare.com). I use anchors instead of buttons and explain why in the quote below. I'd love feedback on the accessibility of that alternative.

It's best to use semantic web tags whenever possible. Buttons are a unique case where you're typically linking somewhere, but the button tag doesn't currently support the href attribute. So, buttons are anchor tags with a class of button.



FWIW, I'm not an expert on this so take what I say with a grain of salt.

An anchor tag that links to another page but looks like a button is probably fine. So long as you can access them via the keyboard (tabbing to it) and they have a distinct appearance when focused so if you are tabbing through you can see whats active (this is different from the hover attribute).


Conceptually, those are links, not buttons. Buttons are for forms and JavaScript and such.


Fair. I would typically us a form tag with an input tag inside it for forms. Sounds like the button tag can be styled a little more because it allows i, em, br, img, and similar tags inside it, while an input does not. They are interchangable in the case of a form (based on your style need).


There are more ways to interact with a link than a button.

You can drag it to your tab bar, bookmarks or desktop, middle click to open in a new tab, copy the target URL etc.

With a button you can push it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: