Bad code
<a type="button" class="button" href="/signup" tabindex="-1">Sign up</a>
Issues and how to fix them
- The
type
attribute has no effect on the semantics of an <a>
element. - An anchor may have the
type
attribute, but the value should be a valid MIME type. Browsers may consider it, but it’s purely advisory. - If the presence of the
href
attribute makes sense, you most definitely want to use a proper link (<a>
) and not a button, no matter how the element looks like in your design. - A negative
tabindex
value means that the element is not accessible via keyboard, but it could be focused with Javascript. - Do not change native semantics, unless you really have to.
- If you need a button, use the
<button>
element.
Good code
<a href="/signup" class="button">Sign up</a>