css链接颜色样式最佳实践 [英] css link color styles best practice
问题描述
有很多CSS样例用于设置链接的样式。
html5boilerplate.com < a>为链接提供此类css代码:
a {color:#00e; }
a:visited {color:#551a8b; }
a:hover {color:#06e; }
对大多数情况来说是否够用?
或者更好的css代码存在为样式的链接的颜色?
请记住,链接样式的正确顺序是:
a:link {color:#c00} / *未访问的链接* /
/ pre>
a:visited {color:#0c0} / * * /
a:hover {color:#00c} / *用户悬停* /
a:active {color:#ccc} / *活动链接* /
大纲
可能看起来丑陋,但这是一个非常重要的辅助功能。如果您删除它 - 请注意提供一种替代方法来正确区分当前元素(更大/更大的字体,高对比度背景等)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屋!