On a two-column page, how can I grow the left div to the same height of the right div using CSS or Javascript?

后端 未结 11 2755
野趣味
野趣味 2020-12-15 07:17

I\'m trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can\'t grow the left div to match the height of the right one. My right di

11条回答
  •  清歌不尽
    2020-12-15 07:43

    Use jQuery for this problem; just call this function in your ready function:

    function setHeight(){
      var height = $(document).height(); //optionally, subtract some from the height
      $("#leftDiv").css("height", height + "px");
    }
    

提交回复
热议问题