I have a flex-based unordered list of social media icons at the bottom of a mobile menu on my website.
I'm trying to get rows of three to sit side by side, equal distance apart. I've managed this with the rule
justify-content:space-around
but my problem is that when there is more than three items, the next row starts filling up from the centre, whereas I'd like it to fill up from the left as the user adds more icons over time.
The further I get with explaining this the more unsure I am as to whether this is even possible, but I thought I'd throw it out there just in case.
Is it possible to make the list items in the next row start from the left of the container without messing up the justify-content:space-around
rule?
At the moment they only line up when there is three in both rows.
Here's the code
.box {
width:275px;
height:275px;
background-color:yellow;
}
ul {
width:auto;
display:flex;
flex-direction:row;
justify-content:space-around;
flex-wrap: wrap;
padding: 30px 20px 30px 20px;
list-style: none;
}
li {
width:30px;
height:30px;
margin:15px;
background-color:red;
}
<div class="box">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</div>