http://ryanfait.com/resources/footer-stick-to-bottom-of-page/
Add the following lines of CSS to your stylesheet. The negative value for the margin in .wrapper is the same number as the height of .footer and .push. The negative margin should always equal to the full height of the footer (including any padding or borders you may add).
* {
margin: 0;
}
立即学习“前端免费学习笔记(深入)”;
html, body {
height: 100%;
}
立即学习“前端免费学习笔记(深入)”;
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
立即学习“前端免费学习笔记(深入)”;
.footer, .push {
height: 4em;
}
立即学习“前端免费学习笔记(深入)”;
Follow this HTML structure. No content can be outside of the .wrapper and .footer div tags unless it is absolutely positioned with CSS. There should also be no content inside the .push div as it is a hidden element that "pushes" down the footer so it doesn't overlap anything.
Your website content here.
http://jingyan.baidu.com/article/2fb0ba4054805900f2ec5f9d.html
//footer吸底效果 var _ch = $("#content").height();//这个就是你中间内容div的高度 var _wh = $(window).height();//整个窗口的高度 //console.log("window's height",_wh,"content's height",_ch,"_wh - _ch:",_wh - _ch); if(_wh - _ch > 192){ $("#content").css("min-height",(_wh-192)+"px"); } //希望这段代码对你有用!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号