代码:
<div id="page-wrapper" class="gray-bg" style="border: 2px solid #00CC00">
</div>
<script>
function myFunction() {
var cliWidth = document.body.clientWidth;
var cliHeigth = document.body.clientHeight;
var divWidth = cliWidth;
var divHeight = cliHeigth;
$('#page-wrapper').css("width", divWidth+"px");
$('#page-wrapper').css("height", divHeight+"px");
}
myFunction();
</script>
参考:https://blog.csdn.net/xuanlv_haoshao/article/details/79782369