利用JS来改变div的高度

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了利用JS来改变div的高度相关的知识,希望对你有一定的参考价值。

var contextBlockHeight = document.getElementById(‘contextBlock‘).clientHeight;
if ( contextBlockHeight > 430) {
    contextBlockHeight = contextBlockHeight + 50;
    document.getElementById(‘middleContextBlock‘).style.height = contextBlockHeight + "px";
}
<div id="contextBlock" class="mTop5 contextArea fontSize13">

</div>

 

以上是关于利用JS来改变div的高度的主要内容,如果未能解决你的问题,请参考以下文章