I wanted my flex items to have an equal size without setting its width.
I know it can be done by setting the flex item to flex: 1;
.
However, I also wanted to break the last item into the next line but keep its width equal to the other item, now I'm stuck.
How can I do that?
ul{
padding: 0;
margin: 0;
list-style-type: none;
display: flex;
flex-flow: row wrap;
}
li{
flex: 1;
border: solid 1px;
text-align: center;
flex-basis: calc(100% / 7);
}
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li class="keep-next-line">7</li> <!--Kepp this next line, but size should be equal to other item-->
</ul>