嘿,我有一个非常烦人的IE7错误,我正在尝试解决。列表项目的底部正在被切断:
IE7
Image in IE7 http://img291.imageshack.us/img291/9363/picture16u.png
火狐
Image in Firefox http://img704.imageshack.us/img704/246/picture17lk.png
这是CSS:
/* begin buttons */
ul.buttons { /* general settings */
margin-left: 0;
margin-bottom: 0em;
margin-right: 0;
margin-top: .0em;
float: left;
height: 23px;
text-shadow: 0px 0px;
text-align: left; /* set to left, right or center */ /* set margins as desired */ /* set font as desired */
list-style-type: none; /* THIRD number must change with respect to padding-top (X) below */
}
ul.buttons li { /* do not change */
display: inline;
height: 35px;
}
ul.buttons li img {
margin-right: 7px;
}
body#tab1 li.tab1, body#tab2 li.tab2, body#tab3 li.tab3, body#tab4 li.tab4 { /* settings for selected tab */
border-bottom: 1px solid #fff; /* set border color to page background color */
background-color: #fff; /* set background color to match above border color */
}
body#tab1 li.tab1 a, body#tab2 li.tab2 a, body#tab3 li.tab3 a, body#tab4 li.tab4 a { /* settings for selected tab link */
background-color: #fff; /* set selected tab background color as desired */
color: #000; /* set selected tab link color as desired */
position: relative;
top: 1px;
padding-top: 4px; /* must change with respect to padding (X) above and below */
}
ul.buttons li a { /* settings for all tab links */
border-bottom-color: #4c9a01;
border-bottom-width: 1px;
border-bottom-style: solid;
letter-spacing: .1em;
color: white;
padding-left: 8px;
padding-bottom: 4px;
padding-right: 8px;
padding-top: 5px;
font-size: .75em; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */ /* set border COLOR as desired; usually matches border color specified in #tabnav */
background-color: #94c909; /* set unselected tab background color as desired */ /* set unselected tab link color as desired */
margin-right: 8px; /* set additional spacing between tabs as desired */
text-decoration: none;
}
和html:
<ul class="buttons">
<li class="tab1"><a href="index.html">Dashboard</a></li>
<li class="tab2"><a href="index2.html">My Leases</a></li>
<li class="tab3"><a href="index3.html">Guide</a></li>
</ul>
我已经搜索了这个,但我似乎无法找到解决方案,任何想法?
答案 0 :(得分:4)
看起来li
元素被ul
元素的高度(23px)截断:
ul.buttons { /* general settings */
margin-left: 0;
margin-bottom: 0em;
margin-right: 0;
margin-top: .0em;
float: left;
height: 23px; /* <--- here */
text-shadow: 0px 0px;
text-align: left; /* set to left, right or center */ /* set margins as desired */ /* set font as desired */
list-style-type: none; /* THIRD number must change with respect to padding-top (X) below */
}
最有可能的是,默认overflow
值在IE和Firefox中有所不同。您可以将ul
高度增加到35px
元素的li
高度吗?
我刚发现display: inline;
元素上的li
。 height
元素会忽略inline
,您应该使用inline-block
代替。
答案 1 :(得分:1)
首先,安装IE Development Tools。它就像Fire Bug一样,可以让你在飞行中改变CSS。
其次,更改实时网站中的CSS以查找问题。
第三,在Firefox中更改CSS和测试。如果它在Firefox中看起来仍然很好,那么你还可以在你的CSS中创建一个IF IE语句:
<!--[if IE 7]>
Special instructions for IE here
<![endif]-->
答案 2 :(得分:0)
首先猜测是一个浏览器忽略ul
的高度并使用li
的高度。为什么你需要在ul.button
s上指定一个比ul.buttons li
更小的高度?