I'm using the flexbox for the first time for a responsive grid system. It seems to be working as far as I tested but want to make sure it works on others too and see ways to improve this.
Please see style.css
for the grid system with flexbox on github.
*{
box-sizing: border-box;
-moz-box-sizing: border-box;
}
html, body{
margin: 0;
}
/*
Layout with flexbox
*/
.container{
max-width: 1200px;
margin: 0 auto;
}
.container--small{
max-width: 800px;
}
.row {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex;
flex-flow: row wrap;
justify-content: space-around;
}
.col{
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1;
}
/*
Extra Layout - 33%
*/
.col--30{
-webkit-box-flex: 0 0 33.3333%;;
-moz-box-flex: 0 0 33.3333%;;
-webkit-flex: 0 0 33.3333%;;
-ms-flex: 0 0 33.3333%;;
flex: 0 0 33.3333%;;
}
/*
Media query
*/
@media (max-width: 768px) {
.row > .col,
.col--30 {
-webkit-box-flex: 0 0 100%;
-moz-box-flex: 0 0 100%;
-webkit-flex: 0 0 100%;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
}
}
<div class="row container">
<div class="col">
<div class="demostyle">1/3 - #1</div>
</div>
<div class="col">
<div class="demostyle">1/3 - #2</div>
</div>
<div class="col">
<div class="demostyle">1/3 - #3</div>
</div>
</div>