This is quite a cool
article I saw a while back on the forgotten
<button> element, which is something that I didn't know about.
Most html writers will be familiar with:
<input type="submit" name="test" value="Click Me" />Suppose though, that you want to make a clickable image. You can use some CSS markup, but instead with the button element, you can also do something like...
<button type="submit" name="test" value="Click Me">
<img src="images/click_me.jpg" alt="Click Me" />
</button>I'm not quite sure on how the best way to deal with screen readers or text-based browsers is, but the alt tag should work fine for that. If not, perhaps a hidden span inside the button element would work better.
#1 Jeroen Mulder says:
I actually always use the negative text-indent image replacement with the button element to create custom looking buttons. Good for accessibility.
This also allows me to keep my presentation in my stylesheet and not need to include an image in the markup (either through inline content in a button or an input of type 'image')
The added benefit is that in most browsers no native OS styling is applied to the button element. For example, it works perfectly in Safari.