I'm playing around with nth-child and trying to create a layout that looks like this
but for some reason the larger divs will only allow one smaller div to display to its side, it pushes the second smaller div down like this:
even though according to the dimensions they should fit. What am I missing or not understanding here? I've included my HTML and CSS below:
#main {
text-align: center;
}
.boxes {
font-size: 30px;
height: 200px;
width: 45%;
background-color: grey;
margin: 10px;
display: inline-block;
}
.boxes:nth-child(6n-2) {
font-size: 30px;
height: 420px;
margin: 10px;
}
.boxes:nth-child(6n-5) {
font-size: 30px;
height: 420px;
margin: 10px;
}
<div id="main">
<div class="boxes">box1</div>
<div class="boxes">box2</div>
<div class="boxes">box3</div>
<div class="boxes">box4</div>
<div class="boxes">box5</div>
<div class="boxes">box6</div>
</div>