IE 7/8: Active Pseudo on Block Elements

情到浓时终转凉″ 提交于 2019-12-11 23:32:52

问题


i have run into problem regarding IE7/8 ignoring the :active pseudo class on elements with display:block;

HTML:

<a>My Link</a>

CSS That Works:

a:active{color:yellow}

CSS That Fails:

a{display:block}
a:active{color:yellow}

Does anyone know of a solution to this, or will I have to resort to JS?


回答1:


Ironically, @Kevin already "fixed" your problem without even realising.

Change the HTML from this:

<a>My Link</a>

to this:

<a href="#">My Link</a>

and it works in IE7, see: http://jsbin.com/exuga3

Unexpected things like this can happen when you have <a> tags without an href attribute.

If you really don't want the "hand mouse pointer", specify cursor: default: http://jsbin.com/exuga3/4



来源:https://stackoverflow.com/questions/5390712/ie-7-8-active-pseudo-on-block-elements

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!