【发布时间】:2013-05-21 17:27:09
【问题描述】:
我想为我的网站制作页脚,并且我希望它被修复(总是在底部)。 它工作正常,看起来不错,但是当内容已满时,它没有显示我给它的 margin-top。请帮忙,我需要一种方法来提供固定的 div - margin-top ... 谢谢。
代码:
<div style="width: 100%; height: 100px; margin-bottom: 50px; background: red;">
</div>
<div style="width: 100%; text-align: center;">
Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />Example of full div<br />
</div>
<div style="width: 100%; height: 50px; margin-top: 50px; background: blue; position: fixed; bottom: 0;">
</div>
【问题讨论】:
-
顺便说一句,内联 css 通常不是最好的主意,随着时间的推移很难维护。