switching stack order of floats with flex

responsive stacking, changing the order of how they stack. so by default they should stack in order they are listed in, like if the pink box is 1st then it should stack on top of the blue box when it goes under 800px width. by using the flex and order we can change the order in which they stack at 800px

Example switching the order

Codepen Example

See the Pen Grid Stacking by Luke (@kruxor) on CodePen.

HTML

<div class="wrapper">
    <div class="pink">
    </div>
    <div class="blue">
    </div>
</div>

CSS

.wrapper {
  display: flex;
  flex-flow: row wrap;
}

.pink {
    background: pink;
    width: 50%;
    height: 300px;
}

.blue {
    background: blue;
    width: 50%;
    height: 300px;
}

@media screen and (max-width:800px) {
    .pink {
        order: 2;
        width: 100%;
    }

    .blue {
        order: 1;
        width: 100%;
    }
}

Other Items in css
Page Views

This page has been viewed 136 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹

Random Quote
You want to be the best, you MUST put the long yards in! Nothing comes easy in life so stop wishing and start DOING! So many people would rather bitch and moan than help themselves. Dont be one of those negative drainers, start today, make a small change and keep going forwards with this attitude!
Unknown