I got an simple CSS grid that I developed myself, it reminds of Twitter bootstrap. I got an row element and several col elements with their own span size classes.
Below is a simple clean example of my code:
.row{
margin-left: -15px;
margin-right: -15px;
position: relative;
overflow-x: hidden;
overflow-y: auto;
}
.row:after,
.row:before{
content: " ";
display: table;
}
.row:after{
clear: both;
}
.col{
display: inline;
float: left;
padding: 0 15px;
position: relative;
min-height: 1px;
}
.span-6{
width: 50%;
}
@media screen and (max-width:780px){
.span-md-12{
width: 100%;
}
}
<div class="row">
<div class="col span-6 span-md-12">World</div>
<div class="col span-6 span-md-12">Hello</div>
</div>
I want the Hello to appear before the World statement in my example. It needs to work when the width is 100% on both columns, so float right on the col element won't cut it.
In other words I want to have an CSS class that I can add so columns that appear after in the HTML can flow before the first column. Any idea how I can achieve this?
Edit: My solution was to add flexbox support in the media query. It seems to have good support for mobiles. See: http://caniuse.com/#feat=flexbox