search

Home  >  Q&A  >  body text

css - Questions about Flex layout

The code I use for flex layout is as follows:
.cszgroup-ul{ display: flex; justify-content: space-between; flex-wrap: wrap; margin-top: 15px; padding-bottom: 5px;}
.cszgroup-ul li{ width: 31%; margin-bottom: 10px;}
The result is this:

My question is: How can I align the red line frame part of the second row to the left?

滿天的星座滿天的星座2787 days ago898

reply all(5)I'll reply

  • phpcn_u1582

    phpcn_u15822017-06-05 11:15:12

    I haven’t tried it, but I thought of a simple way? Add a placeholder p in the penultimate position and set its visibility to hidden. How about it?

    reply
    0
  • 高洛峰

    高洛峰2017-06-05 11:15:12

    cszgroup-ul {
      justify-content: flex-start;
    }

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-06-05 11:15:12

    If your li is not dynamically loaded, there is a stupid way to write an empty li and prop it up.

    reply
    0
  • 天蓬老师

    天蓬老师2017-06-05 11:15:12

    There is no good way, add additional li to occupy the space, and then dynamically add additional nodes to occupy the space after the li here is rendered.

    reply
    0
  • PHP中文网

    PHP中文网2017-06-05 11:15:12

    Give him margin-left:auto;

    for the last one

    reply
    0
  • Cancelreply