JSFiddle Demo爲什麼我的保證金不符合頭寸:固定?
我有一個div的頭和一個內容包裝的div。
出於某種原因,我無法在標題的底部留出邊緣來強制內容包裝下推。它完全忽略它,我不知道爲什麼。
有沒有人知道這是怎麼回事?當我拿走這個位置時它不會這樣做:固定的;屬性的標題,但我希望它被固定在頂部,所以當滾動標題總是在視圖中。
希望有人可以解釋爲什麼會發生這種情況,或者至少它是什麼所以我可以谷歌它。
body {
margin: 0;
padding: 0;
\t font-family: arial;
\t background: #5A9910;
\t text-align: center;
}
/* ==========================Main wrap for page==*/
div.wrap {
\t width: 100%;
\t margin: 0 auto;
\t text-align: left;
}
/* ==========================Header with logo==*/
div.header {
\t position: fixed;
\t width: 100%;
\t background: #ffffff;
\t -webkit-box-shadow: 0 8px 6px -6px #333;
\t -moz-box-shadow: 0 8px 6px -6px #333;
\t box-shadow: 0 8px 6px -6px #333;
}
/* ==========================Header logo image==*/
img.headerlogo {
\t width: 30%;
}
/* ==========================Content wrapper==*/
div.contentwrap {
\t width: 80%;
\t height: 1600px;
\t background: #ccc;
\t margin: 0 auto;
}
<div class="wrap">
<div class="header">
<p>Header</p>
</div>
<div class="contentwrap">
<p>Test</p>
</div>
</div>
大類推... –