How to align flexbox columns left and right?

前端 未结 4 1100
天涯浪人
天涯浪人 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:39

    There are different ways but simplest would be to use the space-between see the example at the end

    #container {    
        border: solid 1px #000;
        display: flex;    
        flex-direction: row;
        justify-content: space-between;
        padding: 10px;
        height: 50px;
    }
    
    .item {
        width: 20%;
        border: solid 1px #000;
        text-align: center;
    }
    

    see the example

提交回复
热议问题