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>
大类推... –