search

Home  >  Q&A  >  body text

前端 - flex布局采用space-around这种方法,但是最后一行如何让他左对齐?


如图最好那两个怎么让他左对齐?

黄舟黄舟2784 days ago1248

reply all(6)I'll reply

  • 阿神

    阿神2017-04-17 14:57:09

    You don’t need space-around, just use flex-start. Be sure to add flex-wrap:wrap

    reply
    1
  • 黄舟

    黄舟2017-04-17 14:57:09

    In this situation, I think it is better to use float layout. If you still use flex, I agree with the above statement.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 14:57:09

    What the person above said is right, this direct percentage calculation is enough, there is no need for flex.
    http://runjs.cn/code/3nq7qacp

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 14:57:09

    Then let me calculate it. Thank you

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 14:57:09

    If the width of each item is the same, you can add a few blank placeholder items and keep the number of columns in each row the same

    reply
    0
  • 黄舟

    黄舟2017-04-17 14:57:09

    flex is used with percentages.

    • If justify-content: space-around;, you need to add a blank placeholder element.

    • If justify-content: flex-start;, no additional elements are needed.

    item internal text-align: center; implements centering.

    reply
    0
  • Cancelreply