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

前端 未结 5 1073
暗喜
暗喜 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:36

    You can also try below code

    CSS goes here

    #container {
        border:1px dashed #000;
        overflow:hidden;
    }
    #content, #sidebar {
        float:left;
        width:50%;
    }
    #content {
        background:yellow;
    }
    
    #sidebar {
        background:grey;
    }
    
    
    #Container
    {
        height: auto;
        width: auto;
    }
    

    and update HTML as follows,

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, Lorem ipsum dolor sit amet, consectetuer adipiscing elit

    Few words

提交回复
热议问题