I have a flexbox-controlled footer. It can contain 1,2 or 3 subordinate divs.
.footer {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
<div class='footer'>
<div>Left</div>
<div>Middle</div>
<div>Right</div>
</div>
With 2 or 3 divs, the css above works fine:
- with three, Left and Right are flushed left and right and Middle is in the middle.
- with 2 they are flushed left and right
But with a single div, it is left-justified. I would prefer it would be centered.
How can I adjust the css so that in the case of a single div it will be centered, while retaining the behaviour for 2 or 3 divs?