我现在有一个HTML设置看起来像:IE7位置:固定和边距问题
<section class="topBar">The site's permanent top bar</section>
<header class="body">Some header info here</header>
而且一个CSS设置,如:
.body { clear: both; margin: 0 auto; width: 600px; }
header {
height: 46px;
margin: 30px auto 20px auto;
}
.topBar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
}
的目标是有顶栏留在页面的顶部,以及页眉之后的所有内容。
大部分工作正常。问题在于,只要topBar具有position:fixed(所以当页面加载时,header几乎隐藏在topBar下方)时,该页眉的顶部页边距会被忽略。
我试着将margin从顶端改为顶端,这也没有帮助。
如何解决被忽略的边缘顶部问题?
这里实际上是一个bug报告,测试页,显示问题:
错误报告:http://www.quirksmode.org/bugreports/archives/2007/03/ie7_positionfixed_and_margin_top_bug.html
非常感谢!我没有完全遵循,但我确实使用了填充顶部。 我最终添加了!padding-top:30px到标题 – MrQuidam