css - CSS:页面底部的页脚重叠内容并具有更高的宽度
问题描述
我希望页脚留在我的网页底部。我做到了,但是如果主要内容很长,则用户无法滚动页面;结果(我猜)是页脚与内容重叠。另一个问题是页脚的宽度大于网站的“页眉”。
这是我的页脚CSS:
#footer {
position: absolute;
bottom: 0;
width: 100%;
font-size: 0.9em;
padding: 2em;
background-color: orange;
border: 0.2em #4040ff;
margin-bottom: 1em;
border-style: solid;}
我还上传了屏幕图像,以便向您展示图形问题。
谢谢你。
解决方案
对我来说总是这样:
html { height: 100%; }
body {
min-height:100%;
position:relative;
padding-bottom:[footer-height]
}
.footer {
position: absolute;
left: 0 ; right: 0; bottom: 0;
height:[footer-height]
}
推荐阅读
- javascript - 如何使用 item.description 在列表视图中选择项目
- java - 如何让骑士在棋盘中随机移动?
- python - 如何在 Python 类中使用方法而不是函数来使用 Bottle?
- python - 检查深层嵌套列表中的条件
- postcss - 如何用带有 postcss8 API `Declaration` 的正则表达式替换`walkDecls`
- java - 具有 Gson 序列化/反序列化的抽象类
- sql - 如何合并两个数据库?
- angular - 以编程方式将 PrimeNG 元素添加到 DOM
- r - 如何计算R空间中定义区域内的值?
- php - codeignitor 3缓存页面未显示