How to justify a single flexbox item (override justify-content)

后端 未结 6 1949
慢半拍i
慢半拍i 2020-12-07 07:11

You can override align-items with align-self for a flex item. I am looking for a way to override justify-content for a flex item.

6条回答
  •  情书的邮戳
    2020-12-07 07:23

    I solved a similar case by setting the inner item's style to margin: 0 auto.
    Situation: My menu usually contains three buttons, in which case they need to be justify-content: space-between. But when there's only one button, it will now be center aligned instead of to the left.

提交回复
热议问题