测试了IE6、IE8、Firefox

<!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> 无标题文档 </title>
<style type=”text/css”>
*{
 margin:0;
 padding:0;
}
html,body{
 height:100%;
 text-align:center;
}
#box{
 width:728px;
 height:100%;
 background:#0066CC;
 margin:auto;
 font-size:30px;
 color:#ffffff;
 font-family: “黑体”;
 position:relative;
}
.bar{
 height:50px;
 background:#f2f2f2;
 position:absolute;
 width:100%;
 left:0;
}
</style>
</head>

<body>
<div id=”box”>
<div style=”top:0;”> a 2</div>
<div style=”padding:50px 0;”> 第一屏满屏的例子.<p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p><p>fds</p> </div>
<div style=”bottom:0;”> b </div>
</div>
</body>
</html>

One Response to “CSS实现满屏(高度自适应)的解决方法”

  1. 九月 14th, 2010 at 1:42 下午 #减肥药排行榜

    文章不错,博客漂亮。

Leave a Reply

请输入算式结果(看不清请点击图片)
(必须)