总结

:link伪类选择器是用来选中元素当中的链接。它将会选中所有尚未访问的链接,包括那些已经给定了其他伪类选择器的链接(例如:hover选择器,:active选择器,:visited选择器)。为了可以正确地渲染链接元素的样式,:link伪类选择器应当放在其他伪类选择器的前面,并且遵循LVHA的先后顺序,即::link:visited:hover:active。:focus伪类选择器常伴随在:hover伪类选择器左右,需要根据你想要实现的效果确定它们的顺序。

例子

a:link {color: slategray;}
.external:link {background-color: lightblue;}

规格详细

Specification Status Comment
HTML Living Standard
:link
Living Standard  
Selectors Level 4
:link
Working Draft 无变化
Selectors Level 3
:link
Recommendation 无变化.
CSS Level 2 (Revision 1)
:link
Recommendation 提升严格性为仅限于a标签元素
CSS Level 1
:link
Recommendation 初次定义

浏览器支持

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 3Opera Full support 3.5Safari Full support 1WebView Android Full support 1.5Chrome Android ? Edge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS Full support 3.2Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

文档标签和贡献者

此页面的贡献者: Ritr, lixinxin93, FuckingChestnut, w0wbin, gengsinan
最后编辑者: Ritr,