简体   繁体   English

简单的菜单。 CSS在IE7中不起作用

[英]Simple menu. CSS not working in IE7

I have the following menu. 我有以下菜单。 Seems to work in all browser but not IE6 or IE7. 似乎可以在所有浏览器中使用,但不适用于IE6或IE7。 What is causing the problem and How can i fix that. 是什么引起了问题,我该如何解决。

Check working example at http://jsfiddle.net/2ysCC/ http://jsfiddle.net/2ysCC/中查看工作示例

#menu_wrap {
    margin-top:20px auto 0 auto;
    padding:0;
    width:780px;
    height:40px;
    list-style-type:none;
}
.button a {
    cursor:pointer;
    text-align:center;
    font:13px/100% Arial, Helvetica, sans-serif;
    font-weight:bold;
    position:relative;
    min-width:50px;
    height:20px;
    float:left;
    padding:10px;
    padding-right:0;
    text-decoration:none;
}

.Red, .Red .button a {
    color:#faddde;
    background: #ed1c24;
}
.button:last-child a {
    float:left;
    border:none;
}

<ul id="menu_wrap" class="Red">
  <li class="button"><a href="#">Home</a></li>
  <li class="button"><a href="#">portfolio</a></li>
  <li class="button"><a href="#">Latest</a></li>
</ul>

This is how it looks in IE7 这就是IE7中的样子 在此处输入图片说明

Add 'display: inline;' 添加“显示:内联;” to your 'li'. 给你的“李”。

#menu_wrap .button {
  display: inline;
}

Here is an article describing the bug in further detail: http://css-tricks.com/501-prevent-menu-stepdown/ 这是一篇详细描述该错误的文章: http : //css-tricks.com/501-prevent-menu-stepdown/

Float the li tags instead of the a tags: 浮动li标签而不是a标签:

.button {
   float: left;
}

JSFiddle JSFiddle

尝试删除position: relative并使其float: left

Use this CSS, float left element <LI> 使用此CSS,向左浮动元素<LI>

li.button{
  float: left;    
}

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

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