I have an unordered list of flex-based social networking icons on the bottom of the mobile menu on my website.
I am trying to make the rows of three sit side by side, at an equal distance from each other. I dealt with this rule
justify-content:space-around
but my problem is that when there are more than three elements, the next line starts filling out from the center, while I would like it to fill on the left , as the user adds more icons over time.
The further I explain this, the more I’m sure how possible it is, but I thought I would throw it away just in case.
Is it possible for the list items in the next line to start to the left of the container without breaking the rule justify-content:space-around?
Currently they line up only when there are three in both lines.
Here is 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>
Run code
source
share