[英]CSS selector :active not working on child element click in IE8
I have the following HTML structure: 我有以下HTML结构:
<div id="ctr__Wrapper" class="wrapper">
<div id="ctr" class="control clickable">
<img src="logo.png">
</div>
</div>
And the following CSS for this: 以下CSS为此:
.control
{
border: 1px solid #000;
background-color: #666;
padding: 20px;
}
.control:active
{
background-color: #bbb;
}
When I click on the element "ctr", I see the background color changing, but when I click on the image itself, it doesn't. 当我点击元素“ctr”时,我看到背景颜色在变化,但是当我点击图像本身时,却没有。 This works fine in Firefox, but not in IE8.
这适用于Firefox,但不适用于IE8。 Is there something I can do to solve this in CSS.
我有什么办法可以在CSS中解决这个问题。
The working example can be seen here: http://jsfiddle.net/miljenko/DNMPd/ 这里可以看到工作示例: http : //jsfiddle.net/miljenko/DNMPd/
You could use a background image instead of a real image. 您可以使用背景图像而不是真实图像。
html: HTML:
<div id="ctr__Wrapper" class="wrapper">
<div id="ctr" class="control clickable">
</div>
</div>
css: CSS:
.control
{
border: 1px solid #000;
background-color: #666;
height: 40+height-of-logopx;
background-image:url(logo.png); background-repeat:no-repeat;
background-position:20px 20px;
}
.control:active
{
background-color: #bbb;
}
because < ie9 don't support :active on anything other than anchor elements. 因为<ie9不支持:激活除锚元素以外的任何东西。 here's your fiddle, that should work in ie8 http://jsfiddle.net/jalbertbowdenii/DNMPd/12/
这是你的小提琴,应该在ie8 http://jsfiddle.net/jalbertbowdenii/DNMPd/12/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.