为什么不这样:访问css风格的工作? [英] Why doesn't this a:visited css style work?

查看:88
本文介绍了为什么不这样:访问css风格的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何理由为什么这在Internet Explorer 9上无效:

 < html& 
< head>
< style>
A {font-weight:bold; color:black;}
A:visited {font-weight:normal;颜色:黑色; }
.Empty {font-weight:bold;颜色:黑色; }
< / style>
< / head>

< body>
< a href =http:// mysite>点击我< / a>
< / body>
< / html>

我点击的链接从不会正常,只是保持粗体。



编辑:它也无法在Chrome中使用。我错了什么?



编辑:更改大小写不会影响它。



< 编辑:更改颜色工作,



编辑:解决方法是更改​​辅助功能以忽略网络颜色。我没有访问源,所以我不得不这样做。

解决方案

实际上,这没有什么具有区分大小写。这是一个安全功能。 :visited 伪类的功能在许多现代浏览器(Fx4,IE9,Chrome)中已被限制以防止CSS exploit:read about it 在这里



如今, code> getComputedStyle()在这些浏览器中通常返回被访问链接的值,就好像他们没有被访问一样。但是,我可以简单地想象一下:使用 font-weight 来访问链接,元素的宽度改变,因此浏览器允许改变 font-weight $


$ b

此问题没有解决方法。


Is there any reason why this does not work on Internet Explorer 9:

<html>
    <head>
        <style>
            A {font-weight: bold; color:black;}
            A:visited {font-weight: normal; color: black; }
            .Empty {font-weight: bold; color: black; }
        </style>
    </head>

    <body>
        <a href="http://mysite">click me</a>
    </body>
</html>

The link I click never goes to normal and just stays bold. On some other browsers it works.

Thanks.

Edit: it doesn't work in chrome either. What am I doing wrong?

Edit: changing case did not affect it.

Edit: changing a to a:link did not affect it.

Edit: changing color works, just not font-weight.

Edit: workaround was to change accessibility to ignore web colors. I do not have access to the source, so I had to do it this way.

解决方案

Actually, this has nothing to do with case sensitivity. This is a security feature. The functionality of :visited pseudoclass has been restricted in many modern browsers (Fx4, IE9, Chrome) to prevent CSS exploit: read about it here.

Nowadays, getComputedStyle() in these browsers usually returns values for visited links as if they weren't visited. However, I can simply imagine circumventing of that: using font-weight for visited links, the element's width changes so browsers that would allow changing font-weight for :visited links wouldn't actually fix the security hole.

Thus, there's no workaround for this issue.

这篇关于为什么不这样:访问css风格的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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