Aligning elements left and center with flexbox

前端 未结 7 478
眼角桃花
眼角桃花 2020-11-29 01:12

I\'m using flexbox to align my child elements. What I\'d like to do is center one element and leave the other aligned to the very left. Normally I would just set the left el

7条回答
  •  被撕碎了的回忆
    2020-11-29 02:12

    I have another solution. In my opinion, Adding an empty block to the center element is fine but code-wise it bit ugly. My solution for this is below

        
    Left Center
    #parent { display: flex; } #left { flex:1; } #center { flex:1; } #parent:after { flex:1; }

提交回复
热议问题