html css equal div height

后端 未结 3 1167
暖寄归人
暖寄归人 2021-01-07 08:46

I have one container div which contain 2 dynamic height (height haven\'t been set) divs side by side , those 2 divs are content divs , sometimes one div have more content th

3条回答
  •  耶瑟儿~
    2021-01-07 09:49

    You can use display:table property for this:

    .parent{
        width:100px;
        display:table;
        border:1px solid green;
    }
    .child{
        width:50px;
        background:blue;
        display:table-cell;
    }
    .child + .child{background:red;}
    

    http://jsfiddle.net/Vbkhq/7/

提交回复
热议问题