(Flexbox) Newbie question re: items-per-row
I'm currently teaching myself Flexbox (via css-tricks) and although everything seems straightforward enough at first glance, I find myself struggling to get the following simple behavior working correctly.
Basically, I'm going for something like this...
<div class="container">
<a href="#">Stuff</a>
<a href="#">Stuff</a>
<a href="#">Stuff</a>
<a href="#">Stuff</a>
</div>
...where a row of 4 anchor tags (or possibly span tags) becomes two rows of 2 tags when the width of the container becomes too narrow for 4. So I want it to skip the 3 & 1 scenario and go right from a row of 4 to two rows of 2. (Even numbers, never an orphaned option alone on a row.) These content "boxes" (a or span) should be of equal width to one another, and top-justified (so if one has more content than the others, it will be vertically longer, but equal-width and top-justified).
With Grid, they were columns so I'd just tell the grid to go from 4 colums to 2 via a @ Media screen declaration, when the viewport got narrower than X pixels. So I'm kind of looking for the Flex equivalent of that behavior (or the closest thing to it).
What would that css look like? I sometimes find it easier to reverse-engineer from the solution.
Thanks!
