我有这个HTML:
<div class="page">
<div class="content">
<p>Lorem ipsum dolor sit amet...</p>
<p>Etiam condimentum lorem faucibus feugiat egestas...</p>
</div>
<div class="footer">
<p class="text-center">Sticky footer with centered text?</p>
</div>
</div>
这个CSS:
body {
background: #222;
margin: 0;
padding: 0;
}
p {
margin: 0 0 20px;
}
.page {
margin-left: 200px;
background: #fff;
min-height: 1200px;
padding: 20px 20px 0;
}
.footer {
position: fixed;
bottom: 0;
background: #eee;
width: 100%;
padding: 20px 20px 0;
margin: 0 -20px;
}
.text-center {
text-align: center;
}
这是jsFiddle(胜过千言万语):
如果有问题的边距导致未对齐,我如何将粘性页脚居中到白页(.page)?
提前致谢!