如何使此标题完全对齐?

时间:2012-11-28 18:16:54

标签: html css html5 css3 header

我使用以下标题设计,它应该在页面的顶部100%水平接管,但在右侧的某些浏览器中它不会覆盖它。

我该如何解决这个问题?

HTML:

 <header id="loop">
 <img src="/images/logo.png" height="50px" />
 </header>

CSS:

 background-color: #990000;
 height: 85px;
 margin-left: -8px;
 margin-top: -8px;
 position: relative;
 width: 101.3%;

2 个答案:

答案 0 :(得分:2)

没有可靠的例子,这有点难以辨别。

确保正文/标题边距值:

body { margin: 0; }

另外,删除放在css中的宽度值并重置边距。你的CSS应该是:

background-color: #990000;
height: 85px;
position: relative;
width: 100%;

答案 1 :(得分:0)

问题是您的负边距为8px,宽度为101.3%。仅当屏幕宽度超过615px时,才会填满整个宽度。

最好的选择是摆脱边距并使用100%的宽度。

相关问题