【发布时间】:2018-03-14 17:49:46
【问题描述】:
我的网站页脚有问题。它与内容 div 重叠。我有这样的结构:
#content {
width: 80%;
color: white;
margin: 0 auto;
font-family: "Arial";
clear: both;
}
#footer {
font-family: "Arial";
left: 0;
right: 0;
bottom: 0;
color: #E6E6E6;
padding: 2%;
font-size: 70%;
text-align: center;
position: absolute;
}
<div id="content">
<div id="logo">
<img logo here>
</div>
<div id="paragraph">
<p>here
</div>
<div id="footer">
Footer content
</div>
</div>
问题是在一个页面中我有一个图像和一个段落,它看起来很好,因为它没有触及页脚位置。但是当我有需要滚动的文本时,页脚会重叠在其中
【问题讨论】:
-
是的,当您使用绝对定位时会发生这种情况。
-
在内容 div 中添加与页脚高度相等的下边距。还有,Orlol 所说的。
-
绝对定位是一种非常糟糕的网页布局方法。它非常不灵活,并且有更好、响应速度更快的选项。查看LearnLayout.com
-
好吧,那我看看相对定位...谢谢