Created
June 1, 2013 09:47
-
-
Save Kilian/5689850 to your computer and use it in GitHub Desktop.
Updates version of http://ajaxian.com/archives/css-3-flexible-box-model adding the latest flexbox spec. Based on http://coding.smashingmagazine.com/2013/05/22/centering-elements-with-flexbox/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hbox { | |
display:-webkit-box; | |
display:-moz-box; | |
display:-ms-flexbox; | |
display:flex; | |
-webkit-box-align:stretch; | |
-moz-box-align:stretch; | |
-ms-flex-align:stretch; | |
-webkit-align-items:stretch; | |
align-item:stretch; | |
-webkit-box-orient: horizontal; | |
-moz-box-orient: horizontal; | |
box-orient: horizontal; | |
flex-direction:row; | |
} | |
.hbox > * { | |
-webkit-box-flex: 0; | |
-moz-box-flex: 0; | |
box-flex: 0; | |
flex:0 0 auto; | |
min-height:auto; | |
min-width:auto; | |
} | |
.hbox:only-child{ | |
width:100%; | |
height:100%; | |
} | |
.vbox { | |
display:-webkit-box; | |
display:-moz-box; | |
display:-ms-flexbox; | |
display:flex; | |
-webkit-box-align:stretch; | |
-moz-box-align:stretch; | |
-ms-flex-align:stretch; | |
-webkit-align-items:stretch; | |
align-item:stretch; | |
-webkit-box-orient: vertical; | |
-moz-box-orient: vertical; | |
box-orient: vertical; | |
flex-direction:column; | |
} | |
.vbox > * { | |
-webkit-box-flex: 0; | |
-moz-box-flex: 0; | |
box-flex: 0; | |
flex:0 0 auto; | |
min-height:auto; | |
min-width:auto; | |
} | |
.vbox:only-child{ | |
width:100%; | |
height:100%; | |
} | |
.spacer { | |
-webkit-box-flex: 1; | |
-moz-box-flex: 1; | |
box-flex: 1; | |
flex:1 1 auto; | |
} | |
.reverse { | |
-webkit-box-direction: reverse; | |
-moz-box-direction: reverse; | |
box-direction: reverse; | |
flex-direction:row-reverse | |
} | |
.boxFlex0 { | |
-webkit-box-flex: 0; | |
-moz-box-flex: 0; | |
box-flex: 0; | |
flex: 0 0 auto; | |
} | |
.boxFlex1, .boxFlex { | |
-webkit-box-flex: 1; | |
-moz-box-flex: 1; | |
box-flex: 1; | |
flex: 1 1 auto; | |
} | |
.boxFlex2 { | |
-webkit-box-flex: 2; | |
-moz-box-flex: 2; | |
box-flex: 2; | |
flex: 2 2 auto; | |
} | |
.boxGroup1 { | |
-webkit-box-flex-group: 1; | |
-moz-box-flex-group: 1; | |
box-flex-group: 1; | |
} | |
.boxGroup2 { | |
-webkit-box-flex-group: 2; | |
-moz-box-flex-group: 2; | |
box-flex-group: 2; | |
} | |
.start { | |
-webkit-box-pack: start; | |
-moz-box-pack: start; | |
box-pack: start; | |
-webkit-justify-content:start; | |
justify-content:start; | |
} | |
.end { | |
-webkit-box-pack: end; | |
-moz-box-pack: end; | |
box-pack: end; | |
-webkit-justify-content:end; | |
justify-content:end; | |
} | |
.center { | |
-webkit-box-pack: center; | |
-moz-box-pack: center; | |
box-pack: center; | |
-webkit-justify-content:center; | |
justify-content:center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment