<p class="tag"> html java 居顶 </p> <style> <br /> body { <br /> font-family: "Times New Roman", "宋体", arial; <br /> font-size: 12px; <br /> margin:0 auto; <br /> text-align: center; <br /> background-image: url(../../images/background_top_0.png) <br /> } <br /> a:link, visited, hover, active { <br /> text-decoration: none; <br /> color: #000000; <br /> } <br /> #header { <br /> position:relative; <br /> margin-top:0px; <br /> width: 1440px; <br /> height: 196px; <br /> <br /> } <br /> #header-top { <br /> position:relative; <br /> margin-top:0px; <br /> width: 1440px; <br /> height: 30px; <br /> <br /> background-image: url(images/background_0.png) <br /> } <br /> #box-top { <br /> position:relative; <br /> margin-top:0px; <br /> left: 200px; <br /> width: 920px; <br /> height: 30px; <br /> } <br /> </style> <br> <div> <br> <div> <br> <div> <br> <div> <br> <a>HOME </a> <br> <a>ABOUT </a> <br> <a>CASE </a> <br> <a>CONTACT</a> <br> </div> <br> </div> <br> </div> <br> </div> <br> <br> 灰色的背景能居顶对齐 <br> <h2>回复讨论(解决方案)</h2> <p class="sougouAnswer"> 就写个空的div 设置高度和背景色 <br> 同时body设置margin:0 <br> 你看下和现在情况一样否 </p> <p class="sougouAnswer"> 将body里面添加属性</p> <p class="sougouAnswer"> -webkit-padding-start: 0px; 加个这个样式 </p> <p class="sougouAnswer"> 就写个空的div 设置高度和背景色 <br> 同时body设置margin:0 <br> 你看下和现在情况一样否 </p> <p class="sougouAnswer"> 外面加个大的div,然后width100%,height100%。OK </p> <p class="sougouAnswer"> 谢谢各位的回答,我已经解决了 </p>