Make floating divs the same height

前端 未结 5 959
离开以前
离开以前 2020-12-01 16:24

I have 2 divs side by side. I don\'t know the height of them upfront, it changed according to the content. Is there a way to make sure they will always be the same height, e

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 16:55

    You can do this without using tables, by using this CSS trick.

    Example - http://jsfiddle.net/LMGsv/

    HTML

       
    text

    CSS

    #wrapper {
        float:left;
        width: 300px;
    }
    #columns {
        float:left;
        width:300px;
        background:blue;
    }
    #left {
        float:left;
        width:50px;
        background: blue;
    }
    #right {
        width:250px;
        background: red;
        float:left
    }
    

提交回复
热议问题