When (and when not to) use an anchor tag?
Published by Chris Coyier
Interesting question from reader Don Wilson:
I'm curious to know your opinion. When should we use anchor tags and when should we use something else?
I have generally used the `a` tag liberally whenever I wanted something to be clickable. I looked up the definition and it appears that I am using the `a` tag where it is not meant to be used. I looked through the GMail source and they are using `div` elements for most of their clickable things.
I think if you are going to put a
If you chose not to use anchor links for clickable functional elements, then:
- Use cursor: pointer; so users get the cursor that looks like you can click like they are used to.
- Use the tabindex attribute on the element so keyboard users can tab to it.