Stretch child div height to fill parent that has dynamic height

前端 未结 5 2085
执笔经年
执笔经年 2020-12-02 12:37

As it can be seen in the following fiddle, I have two divs, contained in a parent div that have stretched to contain the big div, my goal is to mak

5条回答
  •  离开以前
    2020-12-02 13:23

    You can do it easily with a bit of jQuery

    $(document).ready(function(){
      var parentHeight = $("#parentDiv").parent().height();
      $("#childDiv").height(parentHeight);
    });
    

提交回复
热议问题