IE9:悬停故障
我在 IE9、:hover 和 CSS 背景属性中遇到了一些非常奇怪的行为。
就好像悬停属性和非悬停属性在不应该交换的时候交换了(换句话说,悬停属性变成了非悬停属性)。我只使用背景颜色和 SVG 渐变进行测试。这是测试代码(SVG 代码已注释掉)。
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.highlights {
background:black;
/* SVG background gradient for #0791F3 to #068CE0 */
/*
background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9ImczMDkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+CjxzdG9wIHN0b3AtY29sb3I9IiMwNzkxRjMiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMwNjhDRTAiIG9mZnNldD0iMSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2czMDkpIiAvPgo8L3N2Zz4=);
*/
}
.highlights:hover {
background:gray;
/* SVG background gradient for #0064ff to #0051ff */
/*
background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9Imc0NDEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+CjxzdG9wIHN0b3AtY29sb3I9IiMwMDY0RkYiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMwMDUxRkYiIG9mZnNldD0iMSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c0NDEpIiAvPgo8L3N2Zz4=);
*/
}
</style>
</head>
<body>
<div class="highlights">
<h3 class="title" style="color:#FED704">The Quick Brown Fox Jumps Over The Lazy Dog</h3>
<p style="color:white;">This is smaller text</p>
</div>
</body>
</html>
[编辑]:奇怪行为的视频(请记住,悬停时背景应显示为灰色):http ://www.youtube.com/watch?v=8D4Oj25bPlg
I have some really odd behavior surfacing with IE9, :hover, and the CSS background property.
It's almost as if the hover and non-hover properties swap when they aren't supposed to (In other words, the hover properties become the non-hover properties). I was testing just with a background color, as well as an SVG gradient. Here's the test code (with the SVG code commented out).
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.highlights {
background:black;
/* SVG background gradient for #0791F3 to #068CE0 */
/*
background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9ImczMDkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+CjxzdG9wIHN0b3AtY29sb3I9IiMwNzkxRjMiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMwNjhDRTAiIG9mZnNldD0iMSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2czMDkpIiAvPgo8L3N2Zz4=);
*/
}
.highlights:hover {
background:gray;
/* SVG background gradient for #0064ff to #0051ff */
/*
background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9Imc0NDEiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+CjxzdG9wIHN0b3AtY29sb3I9IiMwMDY0RkYiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMwMDUxRkYiIG9mZnNldD0iMSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c0NDEpIiAvPgo8L3N2Zz4=);
*/
}
</style>
</head>
<body>
<div class="highlights">
<h3 class="title" style="color:#FED704">The Quick Brown Fox Jumps Over The Lazy Dog</h3>
<p style="color:white;">This is smaller text</p>
</div>
</body>
</html>
[edit]: Video of the odd behavior (remember, the background should appear gray on a hover): http://www.youtube.com/watch?v=8D4Oj25bPlg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
未启用软件渲染。当我启用它后,问题就消失了。
互联网选项> “高级选项卡”>勾选“使用软件渲染而不是GPU渲染”
Software rendering was not enabled. As soon as I enabled it, the issue vanished.
Internet Options > "Advanced tab" > check "Use software rendering instead of GPU rendering"