css – 浏览器不尊重a:visited {text-decoration:none; }

我无法从访问过的链接删除下划线.在我的计算机中,下面的小提琴在任何浏览器(当前版本的Chrome,Firefox和IE)中显示访问链接的黑色带下划线的文本.

a:link       { color: red;   text-decoration: underline; }
a:visited    { color: black; text-decoration: none;      }
<p><a href="http://www.nevervisited.com">This link is not visited.</a></p>
<p><a href="http://www.google.com">This is link is visited.</a></p>

这是Chrome访问链接的检查员.

我怀疑a:被访问的灰色与此有关,但this question关于灰色样式对我没有任何作用,尽管它帮助了许多其他人.

这些答案(this,this)表明规范并不关心子元素的文本装饰,当他们的祖先定义它时,但我不认为这是这种情况.我的< a> s没有下划线的父母,也没有使用伪元素,而是使用伪类.

此外,如果W3C说明,为什么Chrome会将访问链接应用于:链接

The two states [a:link and a:visited] are mutually exclusive.

也许这与隐藏网站私人信息的用户代理有关,比如W3C在之前的报价之后建议?这个:

Note. It is possible for style sheet authors to abuse the :link and :visited pseudo-classes to determine which sites a user has visited without the user’s consent.

UAs may therefore treat all links as unvisited links,or implement other measures to preserve the user’s privacy while rendering visited and unvisited links differently.

解决方法

您可以在大多数基于Webkit的浏览器(如Safari)或基于Blink(Chrome和Opera)的访问链接上应用的唯一CSS属性彩色的.其他任何东西都行不通.它与浏览器历史窃取有关.您可以从这里阅读更多相关信息:

http://seclists.org/fulldisclosure/2013/May/13

但是,您可以使用{text-decoration:none;}更改所有链接的样式.

选择器本身并不危险,但是如果你将它与J​​avascript的功能结合起来就像getComputedStyle()一样,事情会变得非常丑陋而丑陋我的意思是其他用户可以查看和阅读你的个人浏览器历史记录.

Mozilla(壁虎引擎)limited the selector properties颜色,背景颜色,边框 – * – 颜色.

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效