页脚不会粘到页面的底部 [英] footer not stick to bottom of the page

查看:165
本文介绍了页脚不会粘到页面的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到为什么页脚不粘在页面的结尾的原因,身体并不是真正的100%高度。



我有这个链接中的代码:



https://dl.dropbox.com/u/107452929/flow/CWSMainTitle.htm

解决方案

添加位置:固定

 页脚{
位置:固定;
bottom:0;
left:0;
right:0;
height:30px;
}



如果您希望页尾贴在底部的页面,那么你需要添加一个div来包装整个代码,并给予 position:relative 到wrapper div并保留你的页脚css。



在这种情况下,页脚有父div以应用绝对位置,但在当前代码中,您没有父div来放置绝对位置。



HTML


您的全部html代码在这里
< / div>

CSS

  .wrapper {
position:relative;
height:auto;
}

LIVE DEMO






不特别关于 position:absolute ,那么你可以将它改为 position:relative ,并将页脚html标签放在结束页面。在这种情况下,您不需要添加wrapper div。



DEMO 2


i can't find the reason why the "footer" don't stick to the end of the page,and the body is not really 100% height.

I have the code in this link:

https://dl.dropbox.com/u/107452929/flow/CWSMainTitle.htm

解决方案

Add position:fixed

footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 30px;
}


If you want footer to stick to the bottom of the page then you need to add a div to wrap the entire code and give position:relative to wrapper div and retain your footer css as it is.

In this case footer has parent div to apply the absolute position but in your current code you don't have parent div to place the absolute position.

HTML

<div class="wrapper">
your full html code here
</div>

CSS

.wrapper{
position:relative;
height:auto;
}

LIVE DEMO


If you are not particular about position:absolute then you can just change that to position:relative and place the footer html tag to the end of the page. In this case you need not to add the wrapper div.

DEMO 2

这篇关于页脚不会粘到页面的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆