The problem is the html structure, you put the main div after each in small divs. So, he is going to print this div first.
What I propose to do is change the structure of the html, for example:
put the left column to the left and the right column to the right.
Then put around the div around
add media css so that at 800px (or whatever you need) you can display none; on .hide800 , this hides the div and then adds a div around your current html, but inserts a built-in none display style. Then at 800px (or any other size you hide the first div) add css to display: block !Important;
This way it will work as you need for full-size browsers, but when the screen is small enough to change the structure, you can use your current code.
HTML
<div class="hide800"> <div class="left-col"> <div class="main"> </div> <div class="main"> </div> <div class="main"> </div> </div> <div class-right-col"> <div class="small orange"> </div> <div class="small green"> </div> <div class="small blue"> </div> <div class="small purple"> </div> <div class="small red"> </div> </div> </div> <div class="show800" style="display:none;"> <div class="main"> </div> <div class="small orange"> </div> <div class="small green"> </div> <div class="main"> </div> <div class="small blue"> </div> <div class="small purple"> </div> <div class="main"> </div> <div class="small red"> </div> </div>
CSS
.left-col { float: left; } .right-col { float: right; } @media screen and(max-width:800px){ .hide800 { display: none; } .show800 { display: block !Important; } }
If you need me to explain further, let me know :)
Jay
source share