How to align flexbox columns left and right?

前端 未结 4 1101
天涯浪人
天涯浪人 2020-11-28 03:06

With typical CSS I could float one of two columns left and another right with some gutter space in-between. How would I do that with flexbox?

http://jsfiddle.net/1sp

4条回答
  •  执念已碎
    2020-11-28 03:46

    Another option is to add another tag with flex: auto style in between your tags that you want to fill in the remaining space.

    https://jsfiddle.net/tsey5qu4/

    The HTML:

    Left
    Right

    The CSS:

    .fill-remaining-space {
      flex: auto;
    }
    

    This is equivalent to flex: 1 1 auto, which absorbs any extra space along the main axis.

提交回复
热议问题