html页脚 永远位于底部

html页脚 永远位于底部,第1张

body,html {

margin: 0

padding: 0

height:100%

}

#content {

min-height:100%

position: relative

}

#main {

padding:10px

padding-bottom: 60px

}

#footer {

position: absolute

bottom: 0

background-color: #AAA

width: 100%

}

最快的方式是将底部的设置定位,也是最常见方式。

例子:

<style type="text/css">

.main{

padding-bottom: x px/*x 和底部的高度相同*/

}

.foter{

position: fixed

height: xpx/*x 是你底部的高度*/

width: 100%

left: 0px

bottom: 0px

}

</style>

<div class="header">头部</div>

<div class="main">内容</div>

<div class="footer">底部</div>

希望能给你帮助。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/7485372.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-06
下一篇2023-04-06

发表评论

登录后才能评论

评论列表(0条)

    保存