I currently have a 2 x 2 grid of divs, each set to float:left;
with a width: 400px;
inside a parent div
with width:800px;
. In order for the divs to expand as new content is added or removed, I've added min-height: 150px;
.
The issue arises when a div expands due to new content being added, causing the nicely aligned layout to be disrupted by uneven heights. Is there a way to prevent this?
<div class="boxContainer">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
.boxContainer{
width: 800px;
height: auto;
}
.box{
float: left;
min-height: 150px;
width: 400px;
}