I'm trying to create a grid layout using "float: left" but this is causing the second row to ignore the specified margin-bottom and move up directly below the first row. However, the margin between row two and three is working as expected.
I've tried using "clearfix: both" and "overflow: auto" on the row class.
<div class="row one">
<div class="col-1-of-2">Col 1 of 2</div>
<div class="col-1-of-2">Col 1 of 2</div>
</div>
<div class="row two">
<div class="col-1-of-3">Col 1 of 3</div>
<div class="col-1-of-3">Col 1 of 3</div>
<div class="col-1-of-3">Col 1 of 3</div>
</div>
<div class="row three">
<div class="col-1-of-3">Col 1 of 3</div>
<div class="col-2-of-3">Col 2 of 3</div>
</div>
.row {
max-width: 114rem;
background-color: #eee;
margin: 0 auto;
&:not(:last-child){
margin-bottom: 8rem;
}
.col-1-of-2 {
width: calc((100% - 6rem) / 2);
background-color: orangered;
float: left;
&:not(:last-child) {
margin-right: 6rem;
}
}
}
I would like the margin-bottom of 8rem to be applied between the first and second row.