Created
February 2, 2014 20:14
-
-
Save qmmr/8774145 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 - ordering items | |
%h2 Control display with order | |
%section.flex-container | |
.box.one | |
%h3 One | |
.box.two | |
%h3 Two | |
.box.three | |
%h3 Three | |
.box.four | |
%h3 Four | |
%h2 Control display with flex-flow & justify-content | |
%section.flex-container.reverse | |
.box | |
%h3 One | |
.box | |
%h3 Two | |
.box | |
%h3 Three | |
.box | |
%h3 Four | |
%h2 Control nested display | |
%section.flex-container | |
.box | |
%h3 One | |
.box | |
%h3 Two | |
%section.flex-container.nested | |
.box | |
%h3 One | |
.box | |
%h3 Two | |
.box | |
%h3 Three | |
.box.four | |
%h3 Four | |
.box | |
%h3 Three | |
.box | |
%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"; | |
@import url(http://fonts.googleapis.com/css?family=Audiowide); | |
// Documentation about Flex | |
// http://www.w3.org/TR/css3-flexbox/ | |
$colors: (chartreuse, royalblue, plum, teal, lightsteelblue, sienna, maroon, lime, cornflowerblue, darkviolet, dodgerblue); | |
@for $n from 1 through length($colors) { | |
.box:nth-child(#{$n}) { | |
background-color: nth($colors, $n); | |
} | |
} | |
body { | |
width: 80%; | |
margin: 0 auto; | |
padding: 2%; | |
line-height: 1.6; | |
} | |
.flex-container { | |
@include display-flex(flex); | |
border: 1px solid #333; | |
// flex-flow is a shorthand for flex-direction & flex-wrap | |
@include flex-flow(row); | |
&.reverse { | |
@include flex-flow(row-reverse); | |
@include justify-content(flex-end); | |
} | |
&.nested { | |
@include flex-flow(column); | |
.box { | |
font-size: 1em; | |
} | |
} | |
} | |
.box { | |
color: #222; | |
font-family: 'Audiowide', cursive; | |
font-size: 1.8em; | |
line-height: 1; | |
padding: 10px 20px; | |
text-align: center; | |
text-shadow: 0 -1px 0 #fefefe; | |
} | |
.one { | |
@include order(4); | |
} | |
.two { | |
@include order(3); | |
} | |
.three { | |
@include order(2); | |
} | |
.four { | |
@include order(1); | |
.nested & { | |
@include order(-1); | |
} | |
} |
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
@import url(http://fonts.googleapis.com/css?family=Audiowide); | |
.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; | |
} | |
.box:nth-child(5) { | |
background-color: lightsteelblue; | |
} | |
.box:nth-child(6) { | |
background-color: sienna; | |
} | |
.box:nth-child(7) { | |
background-color: maroon; | |
} | |
.box:nth-child(8) { | |
background-color: lime; | |
} | |
.box:nth-child(9) { | |
background-color: cornflowerblue; | |
} | |
.box:nth-child(10) { | |
background-color: darkviolet; | |
} | |
.box:nth-child(11) { | |
background-color: dodgerblue; | |
} | |
body { | |
width: 80%; | |
margin: 0 auto; | |
padding: 2%; | |
line-height: 1.6; | |
} | |
.flex-container { | |
display: -webkit-flex; | |
display: flex; | |
border: 1px solid #333; | |
-webkit-flex-flow: row; | |
flex-flow: row; | |
} | |
.flex-container.reverse { | |
-webkit-flex-flow: row-reverse; | |
flex-flow: row-reverse; | |
-webkit-justify-content: flex-end; | |
justify-content: flex-end; | |
} | |
.flex-container.nested { | |
-webkit-flex-flow: column; | |
flex-flow: column; | |
} | |
.flex-container.nested .box { | |
font-size: 1em; | |
} | |
.box { | |
color: #222; | |
font-family: 'Audiowide', cursive; | |
font-size: 1.8em; | |
line-height: 1; | |
padding: 10px 20px; | |
text-align: center; | |
text-shadow: 0 -1px 0 #fefefe; | |
} | |
.one { | |
-webkit-order: 4; | |
order: 4; | |
} | |
.two { | |
-webkit-order: 3; | |
order: 3; | |
} | |
.three { | |
-webkit-order: 2; | |
order: 2; | |
} | |
.four { | |
-webkit-order: 1; | |
order: 1; | |
} | |
.nested .four { | |
-webkit-order: -1; | |
order: -1; | |
} |
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 - ordering items</h1> | |
</header> | |
<h2>Control display with order</h2> | |
<section class='flex-container'> | |
<div class='box one'> | |
<h3>One</h3> | |
</div> | |
<div class='box two'> | |
<h3>Two</h3> | |
</div> | |
<div class='box three'> | |
<h3>Three</h3> | |
</div> | |
<div class='box four'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
<h2>Control display with flex-flow & justify-content</h2> | |
<section class='flex-container reverse'> | |
<div class='box'> | |
<h3>One</h3> | |
</div> | |
<div class='box'> | |
<h3>Two</h3> | |
</div> | |
<div class='box'> | |
<h3>Three</h3> | |
</div> | |
<div class='box'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
<h2>Control nested display</h2> | |
<section class='flex-container'> | |
<div class='box'> | |
<h3>One</h3> | |
</div> | |
<div class='box'> | |
<h3>Two</h3> | |
<section class='flex-container nested'> | |
<div class='box'> | |
<h3>One</h3> | |
</div> | |
<div class='box'> | |
<h3>Two</h3> | |
</div> | |
<div class='box'> | |
<h3>Three</h3> | |
</div> | |
<div class='box four'> | |
<h3>Four</h3> | |
</div> | |
</section> | |
</div> | |
<div class='box'> | |
<h3>Three</h3> | |
</div> | |
<div class='box'> | |
<h3>Four</h3> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment