【发布时间】:2013-11-19 23:02:47
【问题描述】:
我的 HTML 代码如下所示:
<article class="post">
<a class="thumbnail" href="#">
<img width="200" height="100" src="some.jpg" class="attachment-thumbnail">
</a>
<header>
<h2 class="posttitle">
<a href="#">Posttitle</a>
</h2>
</header>
</article>
第一个链接中的图片只需要在链接未被访问时显示。如果链接被访问,我会做一个显示:无;
a:visited img {
display: none !important;
visibility: hidden !important;
border: 1px solid red; * this is for testing*
}
http://jsfiddle.net/isherwood/rj394/2
但图像仍然显示。测试边框是红色的。如果我将 :visited 更改为 :hover 它会按应有的方式显示(:hover 并且它消失了)。 Firebus 告诉我,图像是“显示:无”,但显然不是……
有人知道这个问题并知道可能的解决方案吗?
【问题讨论】:
-
你能在jsfiddle.net复制它吗?
-
你不能在 CSS 中引用这样的元素......他需要成为下一个或成为 a 标签的孩子
-
你的 CSS 没有问题,但它不起作用。这是security feature。
-
很好的发现,但为什么你的答案不在答案中?
-
啊。太短且缺少代码或链接的答案有时会被系统移动。