【发布时间】:2011-10-17 18:36:33
【问题描述】:
关于 IE7 具有绝对定位元素的行为,有大量问题和论坛帖子。在我读过的十几篇文章中,其中包含的任何建议都对我的特殊情况没有帮助。我开始怀疑是不是因为我使用的是 HTML5 shiv。无论如何,我希望有人能对我所看到的行为有所了解。
Firefox 5、Safari 5、Chrome 12、IE8/9
Internet Explorer 7
简而言之,您将鼠标悬停在其中一个导航菜单项上,它会下拉一个带有高级菜单的 div,yadda yadda yadda...隐藏的 div 是绝对定位的,但是在 IE7 中它会捕捉到菜单的边缘您突出显示的项目。在其他任何地方,它都会正确显示在其下方。
我正在使用 remy 的 HTML5 shiv。我包含 CSS 以“阻止”以下元素:header、nav、article、footer、section、aside、figure 和 figcaption。
以下是相关的 HTML 和 CSS:
<nav>
//other nav divs
<div id="kb">
<a href="/kb/"><span>knowledge base</span></a>
<div id="kb_expand" class="nav_expand">
<div>
//more options...
<section>
<h2><a href="">Exchange</a></h2>
<ul>
<li><a href="">Exchange Setup</a></li>
<li><a href="">Calendar Basics</a></li>
<li><a href="">Calendar Sharing</a></li>
<li><a href="">Resources</a></li>
</ul>
</section>
//more options...
</div>
</div>
</div>
//other nav divs
</nav>
nav{float:right;margin-top:-26px;text-align:right;width:945px;padding:9px 0 10px}
nav > div{display:inline;padding:8px 0 11px}
.nav_expand{display:none;position:absolute;background:url('images/shadow-south.png') repeat-x bottom;padding-bottom:7px}
.nav_expand div{text-align:left;background:url('images/nav-background.png') repeat-y;width:925px;padding:5px 10px 10px;color:#FFF;margin-top:10px;overflow:hidden}
感谢任何人提供的任何见解!谢谢!
【问题讨论】:
-
我现在无法检查,但我不确定选择器
nav > div在 IE7 中是否正常工作。
标签: css html css-position internet-explorer-7