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
You can use a flex model for this:
.boxes .box
{
margin-left: 2%;
margin-bottom: 2%;
width: 50%;
padding: 4%;
border: 1px solid #b6b6b6;
border: 0.0625rem solid #b6b6b6;
box-sizing: border-box;
}
.box-wrapper
{
width: 100%;
display: -webkit-box;
display: -moz-box;
display: -webkit-flexbox;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
jsFIddle
This way every row will be the height of the highest child element. However the support for this is limited.
So if you rather not use this method you can transform you structure in a table structure. This way every row will be the height of the highest child element.
.boxes .box
{
display: table-cell;
margin-left: 2%;
margin-bottom: 2%;
width: 50%;
padding: 4%;
border: 1px solid #b6b6b6;
border: 0.0625rem solid #b6b6b6;
box-sizing: border-box;
}
.box-wrapper
{
display: table-row;
}
.boxes
{
display: table;
border-collapse: separate;
border-spacing: 5px;
}
Because margin doesn't work between table-cells i used border-spacing
to define the seperation between the cells.
jsFiddle