开发者

outline img hover not working in ie

div img:hover {
outline:2px solid #4d3326;
}

The above code is not working 开发者_开发百科in ie , its working fine in firefox and chrome , may i know what is the problem or any alternative

Thanks


IE6/7 don't support outline, you can see which browser's support it on quirksmode here: http://www.quirksmode.org/css/contents.html#t26

Further, IE6 doesn't support :hover on an <img> either, so it's double-broken there :)


From w3schools:

Internet Explorer 8 (and higher) supports the outline property if a !DOCTYPE is specified.

So either you're using IE6 or IE7, or you don't have a doctype specified.!DOCTYPE is specified.


As mentioned in other posts you can't use :hover for an image in IE, it works only on <a> tags, nor does it support outline in versions below 8.

An alternative would be to wrap your image in an anchor.

<a href="#" class="imagehover">
     <img src="bg_panel_corners.png" alt="" />
</a>

And then you can use a border on the anchor

.imagehover:hover{border:2px solid #4d3326}

I do realise this may not be ideal. If so you can use javascript to enable :hover on none <a> elements, take a look at this article

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜