css link color styles best practice

前端 未结 5 771
遇见更好的自我
遇见更好的自我 2020-12-08 04:30

There are many css-samples for styling color of links.

html5boilerplate.com offers such css code for link:

a { color: #00e; }
a:visited { color: #551         


        
5条回答
  •  情书的邮戳
    2020-12-08 05:19

    That's definitely will suffice in vast majority of cases.

    Just keep in mind that the correct order of styles for links is:

    a:link           { color: #c00 }  /* unvisited links       */
    a:visited        { color: #0c0 }  /* visited links         */
    a:hover, a:focus { color: #00c }  /* user hovers, or focus */
    a:active         { color: #ccc }  /* active links          */
    

    The outline might look "ugly" for you, but that's a very important accessibility feature. If you remove that - please take care of providing an alternative way to properly distinguish the current element (bigger/bolder font, high contrast background etc.)

提交回复
热议问题