如果您只需要担心 Firefox 和 Webkit 浏览器,您会使用什么 CSS 使以下 HTML 中的页脚固定在页面底部? 注意:我不想向页面添加任何标记。
<html>
<body>
<header>...</header>
<article>...</article>
<aside>...</aside>
<footer>...</footer>
</body>
</html>
最佳答案
只需将位置设置为固定并将 bottom 设置为 0:
footer
{
position:fixed;
bottom:0;
}
在 FF、IE7、IE8 等中对我来说是一种享受。这是我在我的一个网站上用于页脚的实际 CSS(一个 id 为 footer
的 div):
#footer
{
clear:both;
color:#FFF;
background:#666;
bottom:0;
border:solid 1px #333;
height:30px;
width:100%;
min-width:950px;
position:fixed;
z-index:100;
}
关于css - 使页脚贴在页面底部而没有多余的标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3150436/