Bad code
<a href="https://example.com">
<button>Example</button>
</a>Issues and how to fix them
- By nesting a button inside of a link, you’re sending two messages: this is a button, but also this is a link.
- If you’re not sure when to use
<a>or<button>, watch The Links vs. Buttons Showdown by Marcy Sutton.
Good code
.button {
/* use CSS to apply button-like styles to the link */
}<a href="https://example.com" class="button">Example</a>