我有一个简单的 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.
附:当我的鼠标悬停在#comment-wrap 的内边距时,下拉菜单保持下拉状态.
P.S. The dropdown menu remain dropped down when my mouse is hovering the padding of #comment-wrap.
我在使用 :hover 伪类时遇到了类似的问题.当我将浏览器的文档模式更改为 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 中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!