我有一些非常简单的html,它的目的是使布局如下所示。
要从我正在使用的用户栏向下推送选项卡
margin-top: 35px;
然而,在internet explorer中,标签完全没有对齐(标签的顶部是底部应该在的位置)。
所以我需要在I浏览器中使用margin-top: -50px;。
为什么会出现这种情况?如何在不使用ie特定的样式表的情况下修复它?
layout example http://webspirited.com/layout.png
<div id="pageHead">
<div id="userBar">
<span class="bold">Hi Matthew Hailwood | <a href="#">Logout</a>
</div>
<a href="http://localhost/buzz/" id="pageLogo"></a>
<div id="pageTabs" class="clearfix">
<ul>
<li><a href="http://localhost/buzzil/templates">Templates</a></li>
<li><a href="http://localhost/buzzil/messaging">Messaging</a></li>
<li><a href="http://localhost/buzzil/contacts">Contacts</a></li>
</ul>
</div>
</div>其中css是
#pageHead {
height: 100px;
}
#pageLogo {
float: left;
width: 149px;
height: 77px;
margin-top: 11px;
background: transparent url('../images/logo.png') no-repeat;
}
#userBar {
text-align: right;
color: #fff;
margin-top: 10px;
}
#userBar a:link,
#userBar a:visited,
#userBar a:active {
font-weight: normal;
color: #E0B343;
text-decoration: none;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
html[xmlns] .clearfix {
display: block;
}
* html .clearfix {
height: 1%;
}
#pageTabs {
float: right;
margin-top: 35px;
}
#pageTabs ul {
position: relative;
width: 100%;
list-style: none;
margin: 0;
padding: 0;
border-left: 1px solid #000;
}
#pageTabs ul li {
float: right;
background: url(../images/tabsBg.png) no-repeat 0% 0%;
border-left: 1px solid #000;
margin-left: -1px;
}
#pageTabs ul li a:link,
#pageTabs ul li a:visited,
#pageTabs ul li a:active {
color: #fff;
background: url(../images/tabsBg.png) no-repeat 100% 0%;
display: block;
font-size: 14px;
font-weight: bold;
line-height: 42px;
text-transform: uppercase;
padding: 4px 32px;
text-decoration: none;
}
#pageTabs ul li a:hover,
#pageTabs ul li a:focus {
text-decoration: underline;
}发布于 2011-02-01 07:29:31
IE不喜欢负的利润率,它倾向于有差异。尝试使用position,以及left,right,top和bottom --从个人经验来看,它更兼容。
你可能只需要稍作调整,就可以将整个页面从页边距转换为定位。
发布于 2011-02-01 07:42:29
尽量不要将html标记用于任何类型的样式。请改用body标记。此外,尝试将pageHead设置为相对定位,然后通过相对或绝对并使用顶部、底部、左侧、右侧来定位其他div,如MT所述。
xD看起来我来晚了一点抱歉的。:3
https://stackoverflow.com/questions/4857283
复制相似问题