Use links and buttons correctly. You are welcome

When making a layout, it is not always clear what is in front of us - a button or a link. Outwardly, these elements may be very similar, but their function is different and the browser reacts to them differently. Therefore, the wrong choice can lead to errors in the site.





Why the problem arises

โ€” . , , . - .





<a>



.





<a href="https://htmlacademy.ru">HTML Academy</a>







โ€” . : , , , . .





<button>



.





<button class="button">9 900 .</button>







, โ€” , โ€” .





An example of two buttons where the bottom one looks like a link
,
Example of a link similar to a button
,

,

URL- <>



, <button>



, , . .





Context menu when right-clicking on a button

โ€” Ctrl .





. URL-, <button>



, .





The address of the correct link in the browser window when you hover over it

,

, , .





Context menu when right-clicking on a link

<a>



, , . ยซยป , , , .





<a href="javascript:;"> </a>







, javascript:;



/#







. .





, :hover



, :focus



, :active , :visited



.





:visited



, :disabled



.





Link states in the layout style guide

. :visited



, :disabled



โ€” .





div โ€“





- ?

- , .





















, . . .





- โ€” , , , , . .









.





, , .





.





.





,

ยซยป. , . , .





 

  • : 7









  • ,





  • โ€” ?






, VESELO



HTML Academy. , ยซ ยป , .








All Articles