gpt4 book ai didi

css - 尽管内容很大,如何使页脚粘在底部?

转载 作者:行者123 更新时间:2023-11-28 17:31:02 25 4
gpt4 key购买 nike

我有这个 CSS 代码:

#main-wrapper {min-height: 300px;}

#main {}

.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden;}

我试过了:clear:both;底部:0;位置:固定;宽度:100%;对于页脚..

但它只适用于短内容显示..当页面内容太长时,我必须向下滚动页面到页脚..

请帮忙

最佳答案

see the example code here

HTML

<div id="main-wrapper">
<div id="content"> content of any length</div>
<div id="footer">Footer</div>
</div>

CSS

* {
padding: 0;
margin: 0;
}
#content {
margin-bottom: 30px;/*same as footer height*/
}
#footer{
position: fixed;
bottom:0;
height: 30px;
background: #eee;
width: 100%;
text-align: center;
}

关于css - 尽管内容很大,如何使页脚粘在底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26088086/

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