在我正在構建的測試頁上,我將這個奇數間距顯示在頁面頂部,我不確定這是爲什麼。在網頁頂部導致奇數間距的CSS
正如你可以從下面的CSS看到,身體標記有margin和padding設置爲0
這裏的測試網站的網址,看看我的意思間距:http://s361608839.websitehome.co.uk/testsite/index.html
CSS :
body{
background: #4f6ca6;
margin: 0;
padding: 0;
}
#header{
background:url(../images/header_bg.jpg) no-repeat center top;
height: 328px;
width: 100%;
border-bottom: 1px solid #223c6d;
-webkit-box-shadow: 0 8px 6px -6px #254379;
-moz-box-shadow: 0 8px 6px -6px #254379;
box-shadow: 0 8px 6px -6px #254379;
}
#slider{
width: 960px;
height: 328px;
margin: 0 auto;
}
HTML:
<div id="header">
<div id="slider">
<h1>Test Site</h1>
<h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h2>
</div>
</div>
喜歡你的答案。將不得不開始注意到Chrome中的檢查元素功能,以幫助我在未來發現:)謝謝! – Tim 2012-04-25 23:30:06