Make children divs the height of tallest child

前端 未结 3 774
情深已故
情深已故 2020-11-29 08:10

I have two child

elements inside of a parent container
as shown:

3条回答
  •  心在旅途
    2020-11-29 08:31

    Another solution is to use flexbox: http://jsfiddle.net/7m4f7/4/

    .item {
        background: rgba(0,0,0,0.1);
        -webkit-box-flex: 1;
        -moz-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
    }
    
    .row {
        border: 1px solid red;
        display: -webkit-box;
        display: -moz-box;
        display: -webkit-flexbox;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
    }
    

    However, support is limited (but getting better!) See http://caniuse.com/flexbox

    Otherwise you need to use javascript to set the heights manually.

提交回复
热议问题