I'd like to left align two items, and right align one when there is sufficient space but center on wrap.
On first wrap (too thin for right item to fit)
- Right item should go to next line and be centered
- Remainder remains left aligned
On Second Wrap (too thin for right + mid item to fit)
- All three items are vertically stacked and centered
Tried having two layers of flex using justify-content: first with space-between, second with center.
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}
.subcontainer {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.item {
border: 1px solid black;
height: 100px;
}
<div class="container">
<div class="subcontainer">
<div class="item">abc abc abc abc abc abc</div>
<div class="item">def def def def def def</div>
</div>
<div class="item">right right right</div>
</div>
http://jsfiddle.net/b3z18rLn/9/
Unfortunately, the right item does not center upon wrapping, and remains left aligned.