研究了一下div+css的高度自適應問題

來源:互聯網
上載者:User

div+css還是比較難搞的,要實現上下兩個div高度自適應感覺麻煩,查了下資料只找到上下高度都是百份比的是可以的,我要實現上面的div是具體像素高度,下面是自適應剩餘的百份比。自己搞了一下還要用上js,不知道是不是很笨,有好的方法請大家帖出來。
<body style=”height:100%; margin:0px; width:100%;”>
<div id=”ddii22″ style=” background-color:#ffffff; height:110px; position:absolute; left:0px; top:0px; width:100%; z-index:1000″>
1111111111111111
</div>
<div id=”ddii” style=” background-color:#999999; height:100%; position:absolute; left:0px; top:110px; width:100%; z-index:100″>
<div style=”height:100%; overflow:auto; “>
</div>
</div>
<script type=”text/javascript”>
document.getElementById('ddii').style.height = document.getElementById('ddii').clientHeight-110 + ‘px';
</script>
</body>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.