我试着为每个页面创建一个页脚。客体是将页脚居中放置在页面底部。您可以检查我的JSFiddle,或直接查看代码,如下所示。如何将页脚放置在CSS页面的底部?
HTML
<div id="page1" class="page">
<div class="footer">
<p>1</p>
</div>
</div>
CSS
div.page {
height: 300px;
width: 180px;
border: 1px solid #000;
margin: auto;
margin-bottom: 5px;
text-align: center;
}
div.footer {
background-color: #DDD;
width: 100%;
bottom: 0; /* doesn't work */
}
p {
width: 15px;
color: white;
background-color: red;
text-align: center;
margin: auto;
bottom: 0;
}
只见约How to position div at the bottom of a page ?类似的问题。然而,当我申请它的主张,底部 + 位置设置,每页中的页脚都合并在一起,放置在导航窗口的底部。这里的相关JSFiddle
有人可以帮忙吗?非常感谢。
检查我的回答,希望它帮助。 –
您需要在页面div上添加'position:relative'和'position:absolute'到页脚div –
@AlessandroIncarnati没有必要评论只是说您已经创建了一个答案。提问者会自动得到通知(并且自己向下滚动并找出它并不困难!)。 –