Accessibility with Jenn

Button versus Anchor

Published on

The humble button and anchor element. These have been in the HTML toolbox for a long time. Anchors appeared in the HTML 2 spec and buttons were formalized in HTML 4.

What is the difference

Buttons are for actions. Anchors are for locations.

Yes, you can style them the same but their semantic meaning is different.

Anchors

The expected behavior of an anchor element is to be taken somewhere. It can be on the same page, a different site, downloading a document, opening a email client, or dialing a number. You have been whisked away to new information.

Buttons

Buttons submit forms. Buttons take action. Buttons do things.