什么是默认HTML / CSS链接颜色? [英] What's default HTML/CSS link color?

查看:163
本文介绍了什么是默认HTML / CSS链接颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要其代码表示,例如 #FFFFFF

解决方案

从HTML5开始,超链接的前景颜色等等正在轨道上进行标准化,形式为预期默认呈现行为准则。特别是,请参阅词组内容部分,建议的未访问的默认颜色和访问的超链接如下:

 :link {color:#0000EE; } 
:visited {color:#551A8B;请注意,对于活动的超链接,没有建议的默认值(:link:



您可以使用这些默认颜色并合理地 工作。但请记住,浏览器可以随意忽略任何或所有这些指南,因为从不需要来跟踪它们。然而,为了跨浏览器的一致的用户体验(这是如何预期在该上下文中被定义), 是建议的,因此大多数浏览器的默认值。在最坏的情况下,它们仍然作为实际值的合理的近似值。



特别地,最新版本中的默认未访问和访问的链接颜色的Firefox和Chrome符合上述指南,但最近版本的IE报告不同的值:未访问的链接是 rgb(0,102,204)#0066CC ,访问过的链接分别是 rgb(128,0,128)#800080 。早期版本的Firefox(以及可能的Safari / Chrome)也有不同的默认值。那些是旧版本,但是;今天我知道的主要异常是IE。目前,它仍然反映与最新版本的IE相同的值。



如果你正在寻找一个标准化的配色方案即所有浏览器都使用 ,而不是HTML5建议的,那么没有一个。也没有办法恢复到使用纯CSS的特定元素上的特定属性的浏览器的默认值。你必须使用HTML5建议的颜色,或者设计你自己的颜色方案,并改用它。



如果有疑问,您可以随时使用 about:blank 技术我之前描述的嗅出默认颜色,因为它仍然适用于今天。您可以使用它来嗅探所有浏览器中的活动链接颜色,例如;在最新版本的Firefox(此更新的29个),它是 rgb(238,0,0)#EE0000


I need its code representation, like #FFFFFF.

解决方案

As of HTML5, the foreground colors of hyperlinks, among other things, are on track for standardization in the form of guidelines for expected default rendering behavior. In particular, taken from the section Phrasing content, the recommended default colors for unvisited and visited hyperlinks are the following:

:link { color: #0000EE; }
:visited { color: #551A8B; }

Notice that there is no recommended default for active hyperlinks (:link:active, :visited:active), however.

You can use these default colors and reasonably expect them to work. But keep in mind that a browser is free to ignore any or all of these guidelines, as it is never required to follow them. It is, however, recommended for a consistent user experience across browsers (which is how "expected" is defined in this context), so chances are that these colors will correspond to the defaults for most browsers. At worst, they still serve as reasonable approximations of the actual values.

In particular, the default unvisited and visited link colors in the latest versions of Firefox and Chrome are consistent with the above guidelines, but recent versions of IE report different values: unvisited links are rgb(0, 102, 204), or #0066CC, and visited links are rgb(128, 0, 128), or #800080. Older versions of Firefox (and possibly Safari/Chrome) had different defaults as well. Those are older versions, however; the main outlier today that I am aware of is IE. No word yet on whether this will change in Project Spartan — currently it still reflects the same values as the latest version of IE.

If you are looking for a standardized color scheme that is used by all browsers rather than suggested by HTML5, then there isn't one. Neither is there a way to revert to a browser's default value for a particular property on a particular element using pure CSS. You will have to either use the colors suggested by HTML5, or devise your own color scheme and use that instead. Either of these options will take precedence over a browser's defaults, regardless of browser.

If in doubt, you can always use the about:blank technique I described before to sniff out the default colors, as it remains applicable today. You can use this to sniff the active link color in all browsers, for example; in the latest version of Firefox (29 as of this update), it's rgb(238, 0, 0), or #EE0000.

这篇关于什么是默认HTML / CSS链接颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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