News for hackers. Stuff that matters.
Re:Defensive CSS by Waterluvian on Thursday December 09, 2021 @09:04PM (#29505636)
Is there a sensible way with flex box wrapping to say “I want you to do your best to keep the rows even in count. If you can’t fit six on a row, don’t just wrap one, wrap three.”
Re:Defensive CSS by jrochkind1 on Thursday December 09, 2021 @09:10PM (#29505667)
For 'don't just wrap one, wrap TWO', I've used nested flex wrappers. For three... I'm not sure if there's a good way to first wrap three then wrap two when there's not enough room for three. But for two, just:

    <div class="display-flex-wrap">
      <div class="display-flex-wrap">
        <div>one</div>
        <div>two</div>
      </div>
      <div class="display-flex-wrap">
        <div>three</div>
        <div>four</div>
      </div>
    </div>
That kind of assumes all the inner div's are the same width too; I'm not sure if your question necessarily does or not.

If it's possible to do something more sophisticated and clever with flexbox I don't know... but maybe with grid? I don't have my head completely wrapped around grid, but currently i naively believe it can literally do anything.

Re:Defensive CSS by andrei_says_ on Friday December 10, 2021 @12:45AM (#29506815)
I add media queries and define percentage widths on the flex items.
Re:Defensive CSS by gherkinnn on Friday December 10, 2021 @08:45AM (#29509737)
I bet there's an unsensible way using :last-child, :nth-child, and percentages.