3 ms·
> Regarding links vs buttons, when you talk about the difference between these, are you referring only to “a” vs “button” HTML elements or something else? > Th
by dmitriid 8y ago
> Regarding links vs buttons, when you talk about the difference between these, are you referring only to “a” vs “button” HTML elements or something else?
> That’s an implementation detail.
It's not. These are semantically different elements.
> For example, to me a link to “learn more” about a product can legitimately be styled as a flat button in many cases.
"Many cases". What cases might that be, and what is the exact difference between a link to "Learn more" and a link to "Related -> Typography"?
Funnily enough, material design guidelines state the following:
--- quote ---
Buttons. Usage. [1]
Buttons communicate actions that users can take. They are typically placed throughout your UI, in places like:
- Dialogs
- Modal windows
- Forms
- Cards
- Toolbars
....
--- end quote ---
> That being said, flat buttons need to be used correctly.
Indeed. <a> means a link to a different page, or a place on the same page. <button> means an action. This is especially true for assistive devices. <a> and <button> behave and interact differently with the content around and inside them (see 4.5.1, 4.6 and 4.10.6 of the HTML Standard [2], and 3.13, 3.5 and 4.3.4 of WAI-ARIA [3])
[1] https://material.io/design/components/buttons.html https://material.io/design/components/buttons.html
[2] https://html.spec.whatwg.org/multipage/#toc-semantics https://html.spec.whatwg.org/multipage/#toc-semantics
[3] https://www.w3.org/TR/wai-aria-practices-1.1/ https://www.w3.org/TR/wai-aria-practices-1.1/