这里是我的示例代码获取有关父DIV高度和家长的高度depand DIV高度depand对文件的高度
<div id="one">
height based on screen
<div id="two">
height based on id="one"
<div>
height based on id="two"
</div>
</div>"
</div>
这里是我的示例代码获取有关父DIV高度和家长的高度depand DIV高度depand对文件的高度
<div id="one">
height based on screen
<div id="two">
height based on id="one"
<div>
height based on id="two"
</div>
</div>"
</div>
html, body { height:100%; }
#one { height:some%; }
#two { height:some%; }
CSS - 没有需要在这里(除非你想以后更改高度)JS。
只需使用$(this).parent().height();
为每div
设置高度和宽度%。它将采用父div的高度和宽度。
应该在哪里调用? – Uooo