gpt4 book ai didi

html - 滚动时将页眉固定在 Hop,底部固定页脚

转载 作者:太空宇宙 更新时间:2023-11-03 22:56:06 25 4
gpt4 key购买 nike

我是 CSS 新手。

如何在页面的完整底部显示页脚

我在这个页面的问题:http://techdefeat.com/index.php

.technology {
min-height: 203em;
}

.foot-nav { background: #fa4b2a;}

在 CSS 中这是我唯一的页脚。

请提供一些简单的引用,感谢您的帮助。

最佳答案

滚动时页眉在顶部,页脚在底部。

为您的主要 div .technology 设置 padding-bottom。这应该等于你的 footer

的高度

JS(jQuery):

$(function(){
$(window).scroll(function(){
var headTop = $('.header-top').height();
if($(this).scrollTop()>=headTop){
$('.head-bottom').addClass('head-top');
else
$('.head-bottom').removeClass('head-top');
}
});
});

CSS:

.head-top{
position: fixed;
width: 100%;
z-index: 999;
}

.technology{
overflow:hidden;
padding-bottom: 180px; // must be same height as the footer
}
.foot-nav {
position: relative;
margin-top: -180px;
height: 180px;
clear:both;
}

关于html - 滚动时将页眉固定在 Hop,底部固定页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38374655/

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