I need to know how to make two columns of text collapse if the screen gets too small (like switching from desktop to a cell phone). I don’t care if tables are used, or divs or whatever.
For example, if I had 2 columns, 3 lines each, like this:
Line 1 Line 4
Line 2 Line 5
Line 3 Line 6
If the 2 columns can’t fit on the screen, I know how to make one drop below the other like this:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
What if my columns were arranged like this though:
Line 1 Line 2
Line 3 Line 4
Line 5 Line 6
If the screen gets too small I would get this:
Line 1
Line 3
Line 5
Line 2
Line 4
Line 6
I still want:
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Any thoughts on how to achieve this?
2
Answers
Check out this example:
https://www.w3schools.com/css/tryit.asp?filename=trycss_mediaqueries_flex
Embedded:
You could solve this with using a grid layout with two rows that changes once the screen is getting smaller than a desired threshold (with media query).
To start I define a simple html example:
And then in your css file: