(在我开始之前我应该说是的,我已经完成了所有的愚蠢检查,是的,链接在我的历史中并且已被访问过等)
我使用的是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而不是透明,访问链接更改为红色,所以显然bg颜色只有在为父级设置bg颜色时才有效.
.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; … 给出以下示例:http://jsfiddle.net/A8v9x/4/ - 当您单击第一个链接然后返回页面时,第一个链接变为绿色.但是,即使访问过的链接被声明有,它仍然没有下划线text-decoration:underline;.即使添加!important到该规则,也不会发生任何变化.
在CSS规范中找不到有关此类行为的任何信息.这是一个常见的浏览器错误吗?如何解决这个问题?
在访问这些链接后,为了删除这些链接的下划线,我需要编写什么CSS代码?
<ul id = "header">
<li><a href="sigur ros.html"> Home </a> </li>
<li>Images</li>
<li>Videos</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我试过这个:
a:visited { text-decoration: none; }
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
这是一个显示问题的小提琴:http://jsfiddle.net/litari/X2Yjk/1/