设置div的高度为屏幕高度

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body style="margin:0px;padding:0px;">
<div id="container">
</div>
</body>
<script>
total = document.documentElement.clientHeight;
document.getElementById("container").style.height=total+"px";
</script>
</html>

猜你喜欢

转载自blog.csdn.net/Zidane_2014/article/details/52638820
今日推荐