:link
:link
该:link
CSS 伪类代表尚未访问过的链接(例如锚)。
/* Selects any link that has not been visited yet */
a:link {
color: red;
}
由:link
伪类定义的样式会被任何后续的与链接相关的,具有至少相等特异性的伪类(:active
,:hover
或:visited
)所覆盖。要正确地设置链接的样式,请将:link
规则放在所有其他与LVHA顺序
定义的链接相关的规则之前::link
- :visited
- :hover
- :active
。
语法
:link
实例
a:link { color: cyan; }
.external:link { color: green; }
规范
Specification | Status | Comment |
---|---|---|
HTML Living StandardThe definition of ':link' in that specification. | Living Standard | |
Selectors Level 4The definition of ':link' in that specification. | Working Draft | No change. |
Selectors Level 3The definition of ':link' in that specification. | Recommendation | No change. |
CSS Level 2 (Revision 1)The definition of ':link' in that specification. | Recommendation | Lift the restriction to only apply it for <a> element. |
CSS Level 1The definition of ':link' in that specification. | Recommendation | Initial definition. |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 1 | (Yes) | 1.0 (1.7 or earlier) | 3.0 | 3.5 | 1.0 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 1.5 | (Yes) | 1.0 (1.9.2) | ? | ? | 3.2 |