I have a two-column layout made up of several separate elements with a variable height:
So far, so good. Now I want to collapse this layout at a certain screen width into a single column ordered by the elements' letters:
A
B
C
D
E
F
My solution is to use a CSS-columns layout on desktop, ordering the elements A-C-E-B-D-F, defining a 2-column-layout and forcing a break after E. Then I switch to flexbox on the smaller viewport and use the order
property to display them in the intended order of A-B-C-D-E-F.
This is not optimal, since the structure of the HTML source will not match the logical order of the content.
Is there a more elegant solution I'm currently missing?