首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IE7中的菜单在悬停时会出现抖动。HasLayout问题?

IE7中的菜单在悬停时会出现抖动。HasLayout问题?
EN

Stack Overflow用户
提问于 2011-11-04 01:39:50
回答 1查看 407关注 0票数 0

当我在IE7中测试时,菜单在第一次鼠标悬停时会抖动,并且会稍微改变位置。此外,当鼠标悬停在包含子菜单的菜单项上时,菜单会再次抖动。我认为这两个问题都与IE7 hasLayout有关,但我不确定。

JSFiddle

有没有办法确保在我的菜单和子菜单标签上的IE7的css中有hasLayout?或者,在IE7中是否插入了文本节点?谢谢你的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-05 14:09:29

确实,你是对的。看起来是个hasLayout issue with IE7

我更改了一个CSS的属性。

代码语言:javascript
复制
#nav {
    margin: 70px 0px 0px -15px;
    padding: 0px;
    list-style: none;
    font-size: 14px;
    position: relative;
}

#nav li a {
    display: inline-block; /* changed it to inline-block for IE compatibility */
    width: 195px; /* declared width since it's now inline-block */
    padding: 0 0 0 15px; /* total width 210px with padding */
    text-decoration: none;
    line-height:20px; /* vertical center with line-height instead */
    color: #262626;
    height: 20px;
}

.subnav {
    margin: -26px 0 0 ;
    padding: 0;
    list-style: none;
    position: absolute;
    display: none;
    left:196px;
    background: #201d1e;
    width: 325px;
}

/* same idea as (#nav li a) */
.subnav a {
    display: inline-block;
    color: #fff !important;
    padding: 0 0 0 15px;
    width: 310px;
    line-height:20px;
    height: 20px;
}

该子菜单呈现的像素比现代浏览器高出几个像素,但是可以使用IE7样式表调整.subnav上的-26px。我认为它接近毛利-顶部:-10px的IE7。希望这能行得通。

http://jsfiddle.net/marioluevanos/VAuYx/11/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7999434

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档