(在开始之前我应该说是的,我已经完成了所有的愚蠢检查,是的,该链接在我的历史记录中并且已被访问过等)
我使用的是 Chrome 版本 6.0.472.63,尽管它适用于所有浏览器很重要。
它适用于 Firefox、IE 和 Opera。
基本上我想做的就是在链接已被访问时更改链接的背景图像。
我已经做了很多试验和错误测试,所以请耐心等待我举多个例子。
这就是我原来的
.forum_box .title a {
background-image:url(../images/f_unread.png);
background-position:10px center;
background-repeat:no-repeat;
background-color:transparent;
color:#2D4054;
font-size:14px;
padding:10px 12px 10px 44px;
text-decoration:none;
display:block;
font-weight:bold;
}
.forum_box .title a:visited {
background-image:url(../images/f_read.png);
}
适用于除 Chrome 之外的所有浏览器。接下来我尝试将其设置为颜色而不是图像。
.forum_box .title a:visited {
background-color:red;
}
再次相同,但是我将链接更改为 #fff 而不是透明,并且访问的链接更改为红色,因此显然背景颜色仅在为父级设置背景颜色时才有效。
.forum_box .title a {
background-image:url(../images/f_unread.png);
background-position:10px center;
background-repeat:no-repeat;
background-color:#fff;
color:#2D4054;
font-size:14px;
padding:10px 12px 10px 44px;
text-decoration:none;
display:block;
font-weight:bold;
}
.forum_box .title a:visited {
background-color:red;
}
但它仍然没有解决我的形象问题。因此,在最后一次尝试中,我尝试了这一点,希望由于某种原因 Chrome 只能在两者都存在相同属性时才能工作。
.forum_box .title a {
background:#fff url(../images/f_unread.png) no-repeat 10px center;
color:#2D4054;
font-size:14px;
padding:10px 12px 10px 44px;
text-decoration:none;
display:block;
font-weight:bold;
}
.forum_box .title a:visited {
background:#fff url(../images/f_read.png) no-repeat 10px center;
}
这也不起作用,并且继续在 Firefox、Opera 和 IE 上运行。所以我来到Stack Overflow很困惑。
任何帮助将不胜感激!
更新:
我已经尝试了 jQuery 解决方案,尽管它仍然不起作用。尽管有 :visited 链接,我可以通过将字体颜色更改为红色来确认其访问状态。 jQuery('a:visited').length 返回 0。