Just dipping my toes into the world of programming. I managed to line up 5 boxes horizontally, but now I want to center them. The challenge is also making sure the boxes remain responsive. I've been scouring for ways to center a div, and all I come up with is
margin: 0 auto; width: 800px;
. However, when I resize my browser to 100%, the fifth box ends up below the others.
.square {
float:left;
width: 12.5vw;
height: 12.5vw;
margin-left: 10px;
margin-right: 10px;
position: relative;
border: 0.5px solid red;
text-align: center;
}
.square span {
font-size: 3vw;
}
<div class="outside">
<div class="square">
<span>2.1</span>
</div>
<div class="square">
<span>2.3</span>
</div>
<div class="square">
<span>2.5</span>
</div>
<div class="square">
<span>2.6</span>
</div>
<div class="square">
<span>2.7</span>
</div>
</div>