CSS Flexbox order x/y div flex-direction.
, :
CSS
.container {
display: flex;
}
@media screen and (max-width: 480px) {
.full_half { width: 100%; }
.text { padding: 0 0 !important; }
.container { flex-direction: column; }
.container:nth-child(2) > .pic { order: -1; }
}
, 480 , divs , - , , , , , .
*,
html,
body {
margin: 0;
padding: 0;
}
.container {
display: flex;
}
.full_half {
display: inline-block;
width: 50%;
background-color: green;
float: left;
min-height: 100px;
}
.pic {
background-color: red;
height: 100px;
}
.text {
box-sizing: border-box;
padding: 20px 120px;
}
@media screen and (max-width: 480px) {
.full_half {
width: 100%;
}
.text {
padding: 0 0 !important;
}
.container {
flex-direction: column;
}
.container:nth-child(2) > .pic {
order: -1;
}
}
<div class="container">
<div class="full_half pic"></div>
<div class="full_half text">test</div>
</div>
<div class="container">
<div class="full_half text">test</div>
<div class="full_half pic"></div>
</div>
<div class="container">
<div class="full_half pic"></div>
<div class="full_half text">
dfdfdfdfdfdffdfdfdfdfdfdfdfdfdfdf
<br />dfdfdfdfdfdffdfdfdfdfdfdfdfdfdfdf
<br />dfdfdfdfdfdffdfdfdfdfdfdfdfdfdfdf
<br />
</div>
</div>
flex (.container) , flexbox (flex-direction: row).
order: 0 . div .pic .container an order -1, (div .text 0). 1, , div .pic. order.
flex-direction (row) column, divs . flex-direction.
: flexbox IE < 10. , Safari 8 IE10, . , , Autoprefixer. .