<div class="container" id="container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
</div>
<div class="controls">
<input type="radio" name="flex-wrap" id="nowrap"
onclick="
var container=document.getElementById('container');
container.style.WebkitFlexWrap = 'nowrap'
container.style.flexWrap = 'nowrap'
" checked>
<label for="nowrap">flex-wrap: nowrap;</label>
<br>
<input type="radio" name="flex-wrap" id="wrap"
onclick="
var container=document.getElementById('container');
container.style.WebkitFlexWrap = 'wrap'
container.style.flexWrap = 'wrap'
">
<label for="wrap">flex-wrap: wrap;</label>
<br>
<input type="radio" name="flex-wrap" id="wrap-reverse"
onclick="
var container=document.getElementById('container');
container.style.WebkitFlexWrap = 'wrap-reverse'
container.style.flexWrap = 'wrap-reverse'
">
<label for="wrap-reverse">flex-wrap: wrap-reverse;</label>
</div>
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
hr {
margin: 50px 0;
}
.container {
margin: 150px auto;
max-width: 800px;
padding: 20px;
-webkit-display: -webkit-box;
-webkit-display: -webkit-flex;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
background-color: #594255;
}
.item {
background-color: #fff;
width: 100px;
height: 100px;
margin: 2px;
text-align: center;
line-height: 100px;
font-weight: bold;
font-family: sans-serif;
font-size: 7em;
color: #594255;
}
.controls {
background-color: white;
width: 300px;
padding: 20px;
line-height: 150%;
position: fixed;
top: 0;
right: 0;
border: 1px solid #ddd;
}