I need help creating a layout with 2 rows of 4 squares, each with a rectangle in the middle of two squares.
https://i.sstatic.net/9pWBi.png
This is the code I currently have:
.main {
width: 100%;
height: auto;
}
.square {
width: 25%;
position: relative;
border: 1px solid black;
float: left;
}
.square:before {
content: "";
display: block;
position: relative;
padding-top: 100%;
}
<div class="main">
<div>
<div class="square">
</div>
<div class="square">
</div>
<div class="square">
</div>
<div class="square">
</div>
<div class="square">
</div>
<div class="square">
</div>
<div class="square">
</div>
<div class="square">
</div>
</div>
</div>
I've tried adding a "rectangle" class:
<div class="square">
<div class="rectangle"></div>
</div>
.rectangle {
width: 80%;
height: 20px;
position: relative;
border: 1px solid yellow;
}
However, I am struggling to position the rectangle in between the two squares. Can anyone provide guidance on this?