【发布时间】:2021-04-19 04:14:21
【问题描述】:
我有一个网页https://jiwidi.me/home/,我有一个页脚,即使我用 js 代码注入 html 代码,我也想留在页面底部。页脚在主页https://jiwidi.me/home/ 上有效,但在https://jiwidi.me/home/blog/ 上无效,例如它不在底部的地方。在博客页面中,我正在实时插入 html 代码,从而使页面的尺寸发生变化。
我当前的页脚 css 如下所示:
footer {
clear: both;
margin-top: -200px;
position: absolute;
bottom: 0;
width: 100%;
height: 2.5rem;
text-align: center;
}
页脚也应该居中。
谢谢!
【问题讨论】:
-
这能回答你的问题吗? How to align content of a div to the bottom
-
请看:stackoverflow.com/questions/643879/… 有很多例子可以做到这一点
标签: javascript html css web