Aligning elements left and center with flexbox

前端 未结 7 485
眼角桃花
眼角桃花 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 01:51

    Since this is 4 years old I figured I'd update this with a much easier CSS Grid solution.

    #parent {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      border: 1px solid black;
      margin: 0 auto;
      width: 500px;
    }
    #center {
      text-align: center;
    }
    Left Center

提交回复
热议问题