Align 2 DIV per line, both the with the same height

前端 未结 4 1776
别那么骄傲
别那么骄傲 2021-01-26 20:40

We have a problem where we need to have a list of divs with dynamic content. There will always be 2 divs per row. Both of those elements should have the same height.

Cur

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-26 21:02

    Have a look at this fiddle You can use display:table-cell;

    CSS:

    .row {
        display: table;
        width: 100%;
    }
    .left {
        width:50%;
        background: blue;
        display:table-cell;
    }
    .right {
        width:50%;
        background: red;
        display:table-cell;
    }
    

    HTML

    "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
    "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos

提交回复
热议问题