`
李瑞曦
  • 浏览: 44241 次
  • 性别: Icon_minigender_2
  • 来自: 大荔
社区版块
存档分类
最新评论

页面布局之DIV设置最小高度,并且要有自适应高度

CSS 
阅读更多

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

  

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics