css链接颜色样式最佳实践 [英] css link color styles best practice

查看:132
本文介绍了css链接颜色样式最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多CSS样例用于设置链接的样式。



html5boilerplate.com < a>为链接提供此类css代码:

  a {color:#00e; } 
a:visited {color:#551a8b; }
a:hover {color:#06e; }

对大多数情况来说是否够用?

或者更好的css代码存在为样式的链接的颜色?



请记住,链接样式的正确顺序是:

  a:link {color:#c00} / *未访问的链接* / 
a:visited {color:#0c0} / * * /
a:hover {color:#00c} / *用户悬停* /
a:active {color:#ccc} / *活动链接* /
/ pre>

大纲可能看起来丑陋,但这是一个非常重要的辅助功​​能。如果您删除它 - 请注意提供一种替代方法来正确区分当前元素(更大/更大的字体,高对比度背景等)


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

html5boilerplate.com offers such css code for link:

a { color: #00e; }
a:visited { color: #551a8b; }
a:hover { color: #06e; }​

Is it good enough for most cases?

Or maybe better css-code exist for styling color of links?

解决方案

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   { color: #00c }  /* user hovers     */
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.)

这篇关于css链接颜色样式最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆