gpt4 book ai didi

html - 确保 div 与页面底部的距离

转载 作者:行者123 更新时间:2023-11-28 16:56:26 29 4
gpt4 key购买 nike

我有一个 <div> (例如注册以获取通知)。我想将 div 的顶部与浏览器底部保持一定距离(无论尺寸大小)。目标是人们将看到 div 的顶部并想向下滚动以查看 div 的其余部分。我试过了,但是当我改变浏览器的大小时,div 的顶部消失了。我的 CSS:

.divider 
{display:block;
position: absolute;
top: 700px;
width: 100%;
text-align: center;
padding:10px
}

感谢您的帮助!

最佳答案

使用margin-bottom属性来保证距离,即:

.divider 
{
display:block;
position: absolute;
top: 700px;
width: 100%;
text-align: center;
padding:10px;
margin-bottom:20px;
/*change this ^ to the distance you want from the bottom of the page*/
}

或者更改 top 属性以确保准确的位置。

关于html - 确保 div 与页面底部的距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32033475/

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