我用需要 :focus 伪类的 CSS 创建了一个网站。选择文本框(即具有焦点)时,我会更改“过滤器”和“背景图像”效果。这适用于 Chrome/FF,但似乎不适用于 IE8(如果是 IE,则可能是以前的版本)。我试图寻找答案,并尝试使用 :active - 但那不起作用。有没有办法使用伪类更改“过滤器”等属性?如果做不到这一点,我可以使用 OnClick 事件在 JS 中完成吗?
谢谢
最佳答案
IE 上的伪类:whatever:hover
Most modern browsers support the :hover selector for any html element. This is cool, because it enables you to, for instance, apply a mouseover effect to table rows using only CSS. IE however, has an erratic support for :hover at best, depending on the particular version your visitor is using.
Whatever:hover is a small script that automatically patches :hover, :active and :focus for IE6, IE7 and IE8 quirks, letting you use them like you would in any other browser. Version 3 introduces ajax support, meaning that any html that gets inserted into the document via javascript will also trigger :hover, :active and :focus styles in IE.
关于javascript - :focus in IE not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2557549/