获取div高度取决于父div高度和父高度取决于文档高度

时间:2013-08-02 09:25:59

标签: javascript jquery

这是我的示例代码

<div id="one">
height based on screen 

     <div id="two">
      height based on id="one"
       <div>
          height based on id="two"
       </div> 
     </div>"

</div>

3 个答案:

答案 0 :(得分:0)

html, body { height:100%; }
#one { height:some%; }
#two { height:some%; }

CSS - 这里不需要JS(除非你想稍后改变高度)。

答案 1 :(得分:0)

只需对每$(this).parent().height();

使用div

答案 2 :(得分:0)

以%为单位设置高度和宽度。它将采用父div的高度和宽度。

相关问题