页脚没有粘在我的页面底部。它只会出现在我的屏幕底部。 (HTML CSS)
Footer not sticking on the bottom of my page. It only goes until the bottom of my screen. (HTML CSS)
我的页脚没有贴在页面底部。它只显示到我的屏幕底部,但是当我向下滚动时,页脚卡在我屏幕底部的位置。它粘在我的屏幕底部,但不在我整个页面的底部。有人请帮助我几乎尝试了一切。正文和 html 也不会占用我整个页面的大小,只会占用我的屏幕大小,即 1920 x 1080。我尝试了各种尺寸,例如 100vh、100%、最小宽度,设置页脚div to absolute with bottom: 0, 其中 none 有效:((我也是新手)
有一次我设法让正文填满了整个页面,但页脚仍然卡在该位置。
实现它的最简单方法是使页面的 正文 100%,最小高度为 100%也。如果页脚 的 高度 没有改变 。
给页脚容器一个负边距顶部:
footer-container {
clear: both;
position: relative;
height: 150px;
margin-top: -150px;
}
尝试将正文设置为:
位置:相对(因此页脚根据正文位置设置其绝对位置)
您甚至可能需要做:
body {
min-height: 100vh //as you have already
position: relative;
padding-bottom: 150px //same height as you footer
}
我的页脚没有贴在页面底部。它只显示到我的屏幕底部,但是当我向下滚动时,页脚卡在我屏幕底部的位置。它粘在我的屏幕底部,但不在我整个页面的底部。有人请帮助我几乎尝试了一切。正文和 html 也不会占用我整个页面的大小,只会占用我的屏幕大小,即 1920 x 1080。我尝试了各种尺寸,例如 100vh、100%、最小宽度,设置页脚div to absolute with bottom: 0, 其中 none 有效:((我也是新手)
有一次我设法让正文填满了整个页面,但页脚仍然卡在该位置。
实现它的最简单方法是使页面的 正文 100%,最小高度为 100%也。如果页脚 的 高度 没有改变 。
给页脚容器一个负边距顶部:
footer-container {
clear: both;
position: relative;
height: 150px;
margin-top: -150px;
}
尝试将正文设置为:
位置:相对(因此页脚根据正文位置设置其绝对位置)
您甚至可能需要做:
body {
min-height: 100vh //as you have already
position: relative;
padding-bottom: 150px //same height as you footer
}