是否可以使用粘性页眉制作粘性页脚?
一切都很好,但是当我应用粘性标题时,我需要body { padding-top: 60px; }
让它不与内容重叠。那么问题是我的页脚在页面下方。
小提琴:http: //jsfiddle.net/NFpDG/
HTML
<div class="wrap">
<div class="header">STICKY HEADER</div>
<div class="content">CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />CONTENT
<br />
</div>
<div class="push"></div>
</div>
<div class="footer">STICKY FOOTER</div>
CSS
html, body, .wrap {
height: 100%;
}
.wrap {
min-height: 100%;
height: auto !important;
height: 100%;
margin-bottom: -60px;
/* for sticky footer to not go below page */
padding-top: 60px;
/* for sticky header to not overlap content */
}
.push, .footer {
height: 60px;
}
.footer {
background-color: green;
}
.content {
background-color: yellow;
}
.header {
background-color: blue;
height: 60px;
width: 100%;
position: fixed;
top: 0;
}