:any-link
:any-link 伪类表示一个作为超链接源锚点的元素(无论它是否已被访问),也就是说,它匹配每一个<a>,<area>或带有href属性的<link>。因此,它匹配所有满足:link或的元素:visited的元素。
/* Select any elements that would be matched by :link or :visited */
/* currently supported with -moz- and -webkit- prefixes */
:-moz-any-link {
color: green;
font-weight: bold;
}
:-webkit-any-link {
color: green;
font-weight: bold;
}
语法
:any-link
实例
:any-link {
color: green;
font-weight: bold;
}
:-moz-any-link {
color: green;
font-weight: bold;
}
:-webkit-any-link {
color: green;
font-weight: bold;
}
<a href="https://mozilla.org">Different page</a>
<a href="#">Anchor</a>
<map name="primary">
<area shape="circle" coords="50,50,25" href="another.html" />
<area shape="default" nohref />
</map>
结果
规范
Specification | Status | Comment |
---|---|---|
Selectors Level 4The definition of ':any-link' in that specification. | Working Draft | Initial definition. |
浏览器兼容性
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | (Yes) -webkit- | No | (Yes) -moz- 50.0 | No | (Yes) -webkit- | (Yes) -webkit- |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) -webkit- | (Yes) -webkit- | No | (Yes) -moz- 50.0 | No | (Yes) -webkit- | (Yes) -webkit- |