【css】容器撑满浏览器--- height:100%

时间:2014-07-23 12:52:36   收藏:0   阅读:445
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>100% Height CSS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
*{ margin:0; padding:0;}
html,body{ padding:0; margin:0; height:100%;}  //必须html,body一起写。单独写body只有ie6可行。
#container{ height:100%; background-color:#0F0;}
</style>
</head>
<body><div id="container"><h1>100% Height Demo</h1><p>内容内容内容内容</p>
</div></body></html>

此demo可实现container撑满浏览器的高度

【css】容器撑满浏览器--- height:100%,布布扣,bubuko.com

原文:http://www.cnblogs.com/positive/p/3862515.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!