Recently, I experimented with creating a layout using Flexbox. My goal was to have a parent element set to display:flex
with a maximum of 7 child elements arranged in rows of 4 and 3 respectively, all centered. Here's an overview of what I attempted:
.parent {
display:flex;
flex-wrap:wrap;
justify-content:center;
}
.child {
width:65px;
height:65px;
border-radius:50%;
overflow:hidden;
flex:0 0 25%;
}
<div class="container">
<div class="parent">
<div class="child"><img src="http://placehold.it/200x200" /></div>
<div class="child"><img src="http://placehold.it/200x200" /></div>
<div class="child"><img src="http://placehold.it/200x200" /></div>
<div class="child"><img src="http://placehold.it/200x200" /></div>
<div class="child"><img src="http://placehold.it/200x200" /></div>
<div class="child"><img src="http://placehold.it/200x200" /></div>
<div class="child"><img src="http://placehold.it/200x200" /></div>
</div>
</div>
While my code is almost functional, there seems to be an issue where the specified width of 65px for each child element is being disregarded. Additionally, I am seeking advice on how I can maintain consistent spacing between the child elements in both rows without exceeding their defined width.