One pet peeve of mine with the button-ish links is that sometimes they only work if I click on the text itself.
<div class="mybutton"><a href="javascript:dosomefoo();">foo</a></div>
instead of <div class="mybutton" onclick="dosomefoo();" style="cursor:pointer;">foo</div>
It's also possible they were trying to support old versions of MSIE in the former.Really the <a> tag should wrap the div, not the other way around.
It also avoids having large "white space" areas that are clickable, when only the text should be clickable. (Like when you wrap an <h1> with an <a> for example.)
This MDN article[1] will help you find the correct attributes and behaviors to make your <div> fully accessible with a button role.
1: https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...
No, if you do the intuitive thing you get:
<a href="http://whereever/">foo</a>
which works fine for every user. a {
display: inline-block;
padding: 4px;
background: lightgray;
border: 2px outset lightgray;
text-decoration: none;
}
a:active {
border: 2px inset lightgray;
}