Google Chrome a:访问的背景图片无法正常显示 [英] Google chrome a:visited background image not working

查看:422
本文介绍了Google Chrome a:访问的背景图片无法正常显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(在我开始之前,我应该说是的,我已经做了所有的愚蠢检查,是的链接在我的历史和已访问等)

(before I start I should say yes, I have done all the stupidity checks, yes the link is in my history and has been visited etc)

它适用于Firefox,IE和Opera。

It works on Firefox, IE and Opera.

基本上所有我想做的是更改链接的背景图片,如果链接已访问。

Basically all i'm trying to do is change the background image of a link if the link has been visited.

我做了

这是我原来的


.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之外的每个浏览器。

Works in every browser except Chrome. Next I tried just making it a colour rather than image.


.forum_box .title a:visited {
 background-color:red;
}

同样,我改变了链接到#fff而不是透明,被访问的链接变成红色,如果您为父项设置了bg颜色,则bg颜色才有效。

Same again, however I changed the link to #fff instead of transparent and the visited link changed red, so apparently the bg colour only works if you set a bg colour for the parent.


.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只会工作,当同时存在的两个相同的属性。

However it still doesn't solve my image problem. So in one final attempt I tried this in the hope that for some reason Chrome would only work when the same properties where present in both.


.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;
}

这没有工作,继续工作在Firefix,Opera和IE。所以我来到这里Stack Overflow非常困惑。

That didn't work either and again continued to work on Firefix, Opera and IE. So I come here to Stack Overflow very confused.

任何帮助将非常感谢!

更新:
我尝试了一个jQuery解决方案,虽然它仍然不工作。尽管有:访问链接,我可以通过将字体颜色更改为红色来确认其访问状态。 jQuery('a:visited')。length返回0。

UPDATE: I've attempted a jQuery solution, although it still doesn't work. Despite having :visited links and I can confirm their visited state by changing the font color to red. jQuery('a:visited').length returns 0.

推荐答案


在CSS中更改背景位置Sprite on a:visited在Firefox 3.6中适用于我,但不在Chrome 6中。

Same problem here. Changing background-position in a CSS Sprite on a:visited is working for me in Firefox 3.6 but not in Chrome 6.

但很快就会停止在Firefox中工作。 (可能为FF 4?)

But probably soon it will stop working in Firefox too. (maybe for FF 4?)

这是一个隐私问题,你可以在这里阅读Mozilla文章(2010年3月)http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to- css-vistited /
和错误:
https:// bugzilla.mozilla.org/show_bug.cgi?id=147777#c160

It's a privacy problem, and you can read here a Mozilla article about it (March 2010) http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/ And the bug: https://bugzilla.mozilla.org/show_bug.cgi?id=147777#c160

我认为只有可能的解决方案是创造性地使用背景颜色而不是图片。

I think only possible solution is to use creatively the background-color instead of images.

这篇关于Google Chrome a:访问的背景图片无法正常显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆