I have an interesting dilemma, I have a layout that consists if a container with 9 div's inside of it. Each div has a class of column-1, column-2 or column-3 on it.
<div class="grid cols-3">
<div class="col column-1">
column-1
</div>
<div class="col column-2">
column-2
</div>
<div class="col column-3">
column-3
</div>
<div class="col column-1">
column-1
</div>
<div class="col column-2">
column-2
</div>
<div class="col column-3">
column-3
</div>
<div class="col column-1">
column-1
</div>
<div class="col column-2">
column-2
</div>
<div class="col column-3">
column-3
</div>
</div>
What I need to do is break these 9 div's into 3 columns of 3 divs with the same class.
I can do this using CSS Grid easily enough, but I need to also create fallbacks for browsers that do not support GRID yet. Which is where I'm struggling.
An example of the markup I am working with is here: https://codepen.io/kirstyburgoine/pen/LmXGZJ
A restriction of this project is that the markup cannot be changed in any way, so this has to be done with CSS (or possibly javascript if thats the only way).
I thought about using flexbox, setting flex-direction: column
and then setting an order on each class. For example: .column-1 { order: 1; }
, .column-2 { order: 2; }
, .column-3 { order: 3; }
. This brought them all into the correct order but of course theye were all in one column instead of 3 and I can't see a way to break a column into a new column with flex. :(
Anyone have any ideas?