Should you use a button tag or an anchor tag in HTML for clickable elements?

preview_player
Показать описание
The answer is surprisingly nuanced, especially if you want to give your users a good UX, as well as keep things accessible and optimal for SEO.
Рекомендации по теме
Комментарии
Автор

This format is perfect, keep going the good work ! Ps: coming from Reddit ;)

antoinenourris
Автор

Plus you can add disabled attribute to the button tag, i use it to preveng the use clicking on a Pay button twice

dailymeow
Автор

exactly what i needed to know. Thank you.

re-member
Автор

very thorough explanation, thank you!

imZaytri
Автор

What if we have in designs where clicking on the outer div (anchor tag in this case) should navigate to a page.

Where as clicking on an inner button should do interactive changes in the same page.

I can't make it accessible. 😢

As clicking on button triggers anchor as well even though I stopped propagation.

sivanesh