gpt4 book ai didi

html - 页脚 Bootstrap 的问题

转载 作者:行者123 更新时间:2023-11-27 23:39:30 25 4
gpt4 key购买 nike

我正在使用 Twitter Bootstrap,是否有任何页脚类?因为我不能让它留在底部。这是我的 jsfiddle https://jsfiddle.net/fNPvf/18578/ .这是页脚 CSS:

.footer-no-nav {
border-top: 1px solid #C2B8B8;
text-align: center;
padding-top: 10px;
padding-bottom: 10px;
}
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
display: block;
}

这是我使用 Bootstrap 类 navbar-fixed-bottom 时的图片 enter image description here

这是调整窗口大小时的情况: enter image description here

解决了我的问题,不需要任何 navbar-fixed-bottom:

html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}

最佳答案

听起来您在使用粘性页脚。

此处更新 fiddle :https://jsfiddle.net/fNPvf/18589/

CSS 依赖于从 margin-top 中移除页脚的总高度,以使页脚粘在底部,除非有足够的内容将其推得更远。对于 40px 高度 + 1px border-top 页脚,这将计算我们的 margin-top 等于 -41px。

footer {
border-top: 1px solid #C2B8B8;
height:40px;
margin-top:-41px;
}

body,html{
height:100%;
}
.container{
min-height:100%;
}

<body>
<div class="container">main content can go here</div>
<footer>sticky footer content is stuck here</footer>
</body>

关于html - 页脚 Bootstrap 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32295275/

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