I have a group of n children within a div. I want to arrange them in a single row and center them horizontally.
If I were to use flexbox, I could achieve this by:
display: flex;
justify-content: center;
Is there a way to accomplish the same layout using grid instead of flexbox?
.a {
height: 20px;
width: 20px;
background: blue;
border: 1px solid red;
}
.b {
display: grid;
gap: 20px;
}
<div class="b">
<div class="a">x</div>
<div class="a">x</div>
<div class="a">x</div>
<div class="a">x</div>
</div>