gpt4 book ai didi

css - 使页脚贴在页面底部而没有多余的标记

转载 作者:搜寻专家 更新时间:2023-10-31 22:35:34 24 4
gpt4 key购买 nike

如果您只需要担心 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com