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

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

问题描述

有许多用于链接颜色样式的 css-samples.

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

html5boilerplate.com 为链接提供了这样的 css 代码:

html5boilerplate.com offers such css code for link:

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

对于大多数情况是否足够好?

或者可能存在更好的 css 代码来设置链接的样式颜色?

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, a:focus { color: #00c }  /* user hovers, or focus */
a:active         { color: #ccc }  /* active links          */

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

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天全站免登陆