开发者

IE 7/8: Active Pseudo on Block Elements

开发者 https://www.devze.com 2023-02-18 04:25 出处:网络
i have run intoproblem regarding IE7/8 ignoring the :active pseudo class onelements开发者_开发百科 with display:block;

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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号