我使用的是:
body {font-size:12px; font-family:"trebuchet MS", verdana, arial, sans-serif; background: #CCCCCC; word-wrap:break-word; height: 100%; margin: 0; padding: 0;
}
#wrapper {
text-align: left;
height:auto;
height: 100%;
margin: 0 auto -200px; /* the bottom margin is the negative value of the footer's height */
padding: 0px;
border:0;
width: 1000px;
background: #FFFFFF;
.footer, .push {
height: 200px; /* .push must be the same height as .footer */
position:absolute;
}它看起来似乎在Firefox/Safari/Opera和IE 6和7中运行良好,但在8中却不能正常工作。
发布于 2009-03-24 12:16:55
你的代码中有一些很大的漏洞,所以我不得不做一些猜测。你可以测试这个,它在我测试的ff3,ie7和ie8上似乎是一样的。
我不确定这是否是你想要的,但你真的应该为你的问题提供一个更好的例子。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<style type="text/css">
html{
height:100%;
margin: 0;
padding: 0;
}
body {
font-size:12px; font-family:"trebuchet MS", verdana, arial, sans-serif;
background: #CCCCCC;
word-wrap:break-word;
height: 100%;
margin: 0;
padding: 0;
}
#wrapper {
text-align: left;
height:auto;
height: 100%;
margin: 0 auto -200px; /* the bottom margin is the negative value of the footer's height */
padding: 0px;
border:0;
width: 1000px;
background: #FFFFFF;
}
.footer,
.push {
height: 200px; /* .push must be the same height as .footer */
position:absolute;
bottom:0;
background:red;
}
</style>
</head>
<body>
<div id="wrapper">Lorem</div>
<div class="footer">Footer jabba jibba jubba hubba bubba dubba dibba dei</div>
</body>
</html>我希望这能有所帮助。
https://stackoverflow.com/questions/674921
复制相似问题