码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2014-07-23 12:52:36      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   re   c   

<!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

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

标签:style   blog   http   color   re   c   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!