简体   繁体   English

Internet Explorer 7 CSS菜单定位

[英]Internet Explorer 7 CSS Menu positioning

I have created a menu in HTML and CSS that works in all the major browsers (Chrome, Firefox, IE8+, and Safari). 我已经创建了HTML和CSS菜单,该菜单可在所有主要浏览器(Chrome,Firefox,IE8 +和Safari)中使用。 You can find it here: http://www.calvaryccm.com/MenuTest.aspx 您可以在这里找到它: http : //www.calvaryccm.com/MenuTest.aspx

The problem occurs in IE 7. 该问题发生在IE 7中。

I have a hover menu using some JS for effect. 我有一个悬浮菜单,使用一些JS效果。 When I try to render it in IE7 this is what happens: 当我尝试在IE7中渲染它时,会发生以下情况:

IE 7菜单错误

I need some help figuring out how to position the menu under the text. 我需要一些帮助来弄清楚如何在文本下方放置菜单。 Thank you for your help! 谢谢您的帮助!

I'm not sure whether you want to use .block or .nav in the selectors below. 我不确定您是否要在下面的选择器中使用.block.nav I've gone with .block because I can see it being applied to the element. 我已经使用了.block因为我可以看到它已应用于元素。

  • On .block ul , remove overflow: hidden . .block ul ,消除overflow: hidden
  • On .block li , add position: relative . .block li ,添加position: relative
  • On .block ul.nav ul , add left: 0 . .block ul.nav ul ,添加left: 0

You now have the infamous IE6/7 z-index problem : 您现在遇到臭名昭著的IE6 / 7 z-index问题

  • To fix it in this case, on .block ul , add position: relative; z-index: 3 要解决此问题,请在.block ul添加position: relative; z-index: 3 .block ul position: relative; z-index: 3 . position: relative; z-index: 3
  • z-index: 3 to be one higher than the z-index on #player-area . z-index: 3#player-area上的z-index高1。

Also, you don't need to use javascript to add the 'hover' class as you've done. 另外,您无需像以前一样使用javascript添加“ hover”类。 Just use the :hover pseudo selector in CSS: 只需在CSS中使用:hover伪选择器即可:

ul.nav > li:hover

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM