How to make sidebar with same height as the content div?

前端 未结 5 1072
暗喜
暗喜 2021-01-19 08:37

the code is the following:

(CSS)

#container {
    border:1px dashed #000;
    overflow:hidden;
}
#content, #sidebar {
    float:left;
    width:50%;
         


        
5条回答
  •  独厮守ぢ
    2021-01-19 09:27

    You can do that by displaying the #container as table and displaying #content and #sidebar as table-cells:

    #container {
        border:1px dashed #000;
        display: table;
        width: 100%;
    }
    #content, #sidebar {
        display: table-cell;
        width:50%;
    }
    

    Check your updated Fiddle.

提交回复
热议问题