How do I use display:flex and justify-content:space-between, where the flex-item gets centered if there is only one of them?

Here’s how you do it:

#container {
    display: flex;
    justify-content: space-between;
}

.flexItem:nth-child(1):nth-last-child(1) {
    margin: 0 auto;
}

Leave a Comment