:hover在IE9中无法正常工作 [英] :hover is not working properly in IE9
问题描述
我有一个简单的CSS下拉菜单里面有一个iframe。当我将鼠标悬停在下拉菜单上时,菜单下降。但是当我的鼠标悬停在菜单中的iframe时,菜单返回。这是我的代码的简化版本:
I have a simple CSS dropdown menu with an iframe inside it. When I hover my mouse over the dropdown menu, the menu drops down. But when my mouse hovers the iframe inside the menu, the menu goes back. Here's a simplified version of my code:
<div id="comments">
<a href="#" class="btn">View comments</a>
<div id="comment-wrap">
<iframe src="http://www.facebook.com/plugins/comments.php?..."></iframe>
</div>
</div>
<style type="text/css">
#comment-wrap{display:none;z-index:5;position:absolute;padding:10px;background-color:#fff;}
#comments:hover #comment-wrap{display:block;}
</style>
这适用于最新版本的FF,Chrome和Opera。
This works in the latest versions of FF, Chrome, and Opera.
PS
推荐答案
我遇到了类似的问题,而我的鼠标悬停在#comment-wrap的填充。使用:hover psuedo类。它开始工作正常,当我将浏览器的文档模式更改为IE 9和浏览器模式也设置为IE9。默认情况下,IE 9的文档模式设置为IE8。
I have faced similar problems while working with the :hover psuedo class. It started working fine when I changed the Document mode of the browser to IE 9 and the Browser mode also set to IE9. IE 9 has the document mode set to IE8 by default.
此外,您还可以在head标签中添加以下元信息:
Additionally, you can add the following meta info in the head tag:
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
希望这有帮助。
这篇关于:hover在IE9中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!