<style type="text/css">
/*<![CDATA[*/
div {
width:200px;
height:auto!important;
height:200px;
min-height:200px;
border:1px solid green;
}
/*]]>*/
</style>
动态设置DIV高度:
<script> function onLoad(){
var workSpaceW = document.getElementById("body").parentElement.offsetWidth;//宽度
var workSpaceH = document.getElementById("body").parentElement.offsetHeight;//高度
document.getElementById("flowDiv").style.height = workSpaceH-75 ;
}</script>
<body id="body" onload="onLoad()">
<div id="flowDiv" style="width: 150px;; OVERFLOW-X: auto; OVERFLOW: scroll">
dddd</div>
</body>
本文介绍了一种通过JavaScript动态调整网页中DIV元素高度的方法。利用此方法可以根据父元素的高度自动调整DIV的高度,确保内容能够完全展示并且保持良好的视觉效果。
558

被折叠的 条评论
为什么被折叠?



