Created
February 1, 2014 15:03
-
-
Save qmmr/8753426 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
%header | |
%h1 Flexbox | |
%p Comparison of different Flex values | |
%article | |
%h2 flex: 100px | |
%section.flex-container.hundredpx | |
.box.flex1 | |
%h3 One | |
.box.flex1 | |
%h3 Two | |
.box.flex2 | |
%h3 Three | |
.box.flex1 | |
%h3 Four | |
%h2 flex: 0 | |
%section.flex-container.auto | |
.box.flex1 | |
%h3 One | |
.box.flex1 | |
%h3 Two | |
.box.flex2 | |
%h3 Three | |
.box.flex1 | |
%h3 Four | |
%h2 flex: auto | |
%section.flex-container.zero | |
.box.flex1 | |
%h3 One | |
.box.flex1 | |
%h3 Two | |
.box.flex2 | |
%h3 Three | |
.box.flex1 | |
%h3 Four | |
%h2 flex: 1 | |
%section.flex-container.shorthand | |
.box.flex1 | |
%h3 One | |
.box.flex1 | |
%h3 Two | |
.box.flex2 | |
%h3 Three | |
.box.flex1 | |
%h3 Four |
This file contains hidden or 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
// ---- | |
// Sass (v3.3.0.rc.2) | |
// Compass (v1.0.0.alpha.17) | |
// ---- | |
@import "compass"; | |
$colors: (chartreuse, royalblue, plum, teal, lightsteelblue, sienna, maroon); | |
body { | |
width: 80%; | |
margin: 0 auto; | |
padding: 2%; | |
line-height: 1.6; | |
} | |
.flex-container { | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
margin: 1em 0; | |
border: 1px solid #333; | |
} | |
.box { | |
text-align: center; | |
} | |
@for $n from 1 through 4 { | |
.box:nth-child(#{$n}) { | |
background-color: nth($colors, $n); | |
} | |
} | |
.flex1 { | |
.hundredpx & { | |
@include flex(1 1 100px); | |
} | |
.zero & { | |
@include flex(1 1 0); | |
} | |
.auto & { | |
@include flex(1 1 auto); | |
} | |
.shorthand & { | |
@include flex(1); | |
} | |
} | |
.flex2 { | |
.hundredpx & { | |
@include flex(2 1 100px); | |
} | |
.zero & { | |
@include flex(2 1 0); | |
} | |
.auto & { | |
@include flex(2 1 auto); | |
} | |
.shorthand & { | |
@include flex(2); | |
} | |
} |
This file contains hidden or 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
body { | |
width: 80%; | |
margin: 0 auto; | |
padding: 2%; | |
line-height: 1.6; | |
} | |
.flex-container { | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
margin: 1em 0; | |
border: 1px solid #333; | |
} | |
.box { | |
text-align: center; | |
} | |
.box:nth-child(1) { | |
background-color: chartreuse; | |
} | |
.box:nth-child(2) { | |
background-color: royalblue; | |
} | |
.box:nth-child(3) { | |
background-color: plum; | |
} | |
.box:nth-child(4) { | |
background-color: teal; | |
} | |
.hundredpx .flex1 { | |
-webkit-flex: 1 1 100px; | |
flex: 1 1 100px; | |
} | |
.zero .flex1 { | |
-webkit-flex: 1 1 0; | |
flex: 1 1 0; | |
} | |
.auto .flex1 { | |
-webkit-flex: 1 1 auto; | |
flex: 1 1 auto; | |
} | |
.shorthand .flex1 { | |
-webkit-flex: 1; | |
flex: 1; | |
} | |
.hundredpx .flex2 { | |
-webkit-flex: 2 1 100px; | |
flex: 2 1 100px; | |
} | |
.zero .flex2 { | |
-webkit-flex: 2 1 0; | |
flex: 2 1 0; | |
} | |
.auto .flex2 { | |
-webkit-flex: 2 1 auto; | |
flex: 2 1 auto; | |
} | |
.shorthand .flex2 { | |
-webkit-flex: 2; | |
flex: 2; | |
} |
This file contains hidden or 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
<header> | |
<h1>Flexbox</h1> | |
<p>Comparison of different Flex values</p> | |
</header> | |
<article> | |
<h2>flex: 100px</h2> | |
<section class='flex-container hundredpx'> | |
<div class='box flex1'> | |
<h3>One</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Two</h3> | |
</div> | |
<div class='box flex2'> | |
<h3>Three</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
<h2>flex: 0</h2> | |
<section class='flex-container auto'> | |
<div class='box flex1'> | |
<h3>One</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Two</h3> | |
</div> | |
<div class='box flex2'> | |
<h3>Three</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
<h2>flex: auto</h2> | |
<section class='flex-container zero'> | |
<div class='box flex1'> | |
<h3>One</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Two</h3> | |
</div> | |
<div class='box flex2'> | |
<h3>Three</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
<h2>flex: 1</h2> | |
<section class='flex-container shorthand'> | |
<div class='box flex1'> | |
<h3>One</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Two</h3> | |
</div> | |
<div class='box flex2'> | |
<h3>Three</h3> | |
</div> | |
<div class='box flex1'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
</article> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment