#4 link-also-button

submitted on by Hidde

Bad code

<a href="https://example.com">

Issues and how to fix them

  1. By nesting a button inside of a link, you’re sending two messages: this is a button, but also this is a link.
  2. 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>