我要做一个布局,要求footer始终在页面的最下面。
代码如下:
nbsp;html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
*
{
margin: 0;
padding: 0;
}
html, body
{
height: 100%;
min-height: 100%;
}
#wrapper
{
min-height: 100%;
background: url(line.png);
position: relative;
margin-bottom: 60px;
display: block;
position: relative;
z-index: 1px;
}
* html #wrapper
{
height: 100%;
}
#footer
{
background: gray;
height: 60px;
margin-top: -120px;
z-index: 2px;
position: relative;
}
#main
{
border: 1px solid red;
display: block;
height: 500px;
padding-bottom: 60px;
padding-bottom: 40px\9; /* ie 8/9*/
padding-bottom: 26px\9\0; /* ie 9*/
}
.clearfix:after
{
content: “.”;
display: block;
height: 0;
clear: both;
visibility: hidden;
}
*html .clearfix
{
height: 1%;
}
* + html .clearfix
{
height: 1%;
}
#header
{
background: blue;
height: 50px;
display: block;
position: relative;
z-index: 1;
}
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
dafasdf
在IE9 chrome firefox 和 safari 下都没有问题,在IE8下面 如果你把浏览器的高度缩小到出滚动条,就会在footer下面出现一个白边,拜托大家帮忙看看。
回复讨论(解决方案)
如果用table布局则兼容所有浏览器,DIV+CSS都流行这么多年了 总不能还让我用table吧
你确定是ie8这样吗?我在ie8下试你的代码如下显示
你看我的那个截图,就是下面的白边,你能再看看你的是IE8吗?我怎么看起来有点像IE7呢。 我用的IE9的兼容模式和IETester测试的。 要IE8真的像你那样就好了啊
我测试IE8的时候 如果没出滚动条的时候footer真好在最下面,一出滚动条就出现白边了。
我的系统是win2003,IE是如假包换的8
难道win7的不一样了,我是win7我郁闷了。
ietest和真实的ie有区别
我用IE8也有问题,最后不管了table搞定