If you need the centered in the exact middle of its parent, then the simplest is to use 3 wrappers, containing the items, and give them flex-basis: 33.333%
.
With this you can then easily control how the items should wrap on smaller screens.
ul {
display: flex;
width: 100%;
list-style: none;
padding: 0;
}
ul li {
flex-basis: 33.333%;
display: flex;
}
ul li:nth-child(2) span {
margin: auto; /* align center */
}
ul li:nth-child(3) span:first-child {
margin-left: auto; /* align right */
}
<ul>
<li>
<span>Item 1</span><span>Item 2</span><span>Item 3</span>
</li>
<li>
<span>Item 4</span>
</li>
<li>
<span>Item 5</span><span>Item 6</span>
</li>
</ul>
Another option is to use flex: 1 1 0
on the left/right wrappers
ul {
display: flex;
width: 100%;
list-style: none;
padding: 0;
}
ul li {
display: flex;
}
ul li:nth-child(1),
ul li:nth-child(3) {
flex: 1 1 0;
}
ul li:nth-child(3) span:first-child {
margin-left: auto;
}
<ul>
<li>
<span>Item 1</span><span>Item 2</span><span>Item 3</span>
</li>
<li>
<span>Item 4</span>
</li>
<li>
<span>Item 5</span><span>Item 6</span>
</li>
</ul>
Yet another, keeping the existing markup, is to use auto margins, though then the centered will be between, in this case, 3 and 5.
ul {
display: flex;
width: 100%;
list-style: none;
padding: 0;
}
ul li:nth-child(4) {
margin: auto;
}
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
</ul>