我设计了一个网站,它在所有浏览器中运行良好,但IE,我使用了模板导航栏并将其作为我的导航栏中的样式表通过我的网站,但当我在Internet Explorer中查看时父项的子元素显示在浏览器的左侧,到目前为止它们都离开了查看器窗口。我试图摆弄css代码,但似乎没有任何效果,我尝试改变位置并在导航栏编码中摆脱绝对位置,这使得元素出现在页面上,但它们遍布整个地方。
CSS:
/* The outermost container of the Menu Bar, an auto width box with no margin or padding */
ul.MenuBarHorizontal
{
margin: 0;
padding: 0;
list-style-type: none;
cursor: default;
width: auto;
color: #ed3694;
font-family: Arial, Helvetica, sans-serif;
}
/* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
ul.MenuBarActive
{
z-index: 1000;
}
/* Menu item containers, position children relative to this container and are a fixed width */
ul.MenuBarHorizontal li
{
margin: 0.1em;
padding: 0;
list-style-type: none;
font-size: 100%;
position: relative;
text-align: center;
cursor: pointer;
width: 8.6em;
float: right;
visibility: visible;
}
/* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
ul.MenuBarHorizontal ul
{
margin: 0.1;
padding: 0;
list-style-type: none;
font-size: 100%;
z-index: 1020;
cursor: default;
position: absolute;
width: 191px;
left: -1000px;
height: 111px;
visibility: visible;
top: 34px;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
{
left: -52px;
font-family: Arial, Helvetica, sans-serif;
}
/* Menu item containers are same fixed width as parent */
ul.MenuBarHorizontal ul li
{
width: 8.6em;
}
/* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
ul.MenuBarHorizontal ul ul
{
position: absolute;
margin: -5% 0 0 95%;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
{
left:auto;
top: 0;
}
查看源代码的网页:www.mopowered.co.uk
如果有人能提供帮助,我会非常感激。我只需要在IE中正常工作。
丹娘
答案 0 :(得分:0)
出于某种原因,li
中的MenuBarItemIE
个position:static
位于position:relative
。如果您将其更改为li
,则会移动{{1}}元素下的内容(例如,不如ff,但更好。如果您不知道问题是什么,请告诉我。)
答案 1 :(得分:0)
您使用的Spry Menu js库存在很多问题(快速进行谷歌搜索)。也许你应该考虑使用别的东西。
但是我通过评论/删除SpryMenuBar.js中的以下行来获得快速而肮脏的修复
if(Spry.is.ie)
{
this.addClassName(items[i], this.isieClass);
items[i].style.position = "static";
}
我认为这不是正确的解决方案,但它似乎适用于您的情况。