Last active
November 29, 2016 18:15
-
-
Save exarcheia-web/84aee75322e86f2fa661db5da29fb9f7 to your computer and use it in GitHub Desktop.
Flexbox slightly more advanced example
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
| /* Flexbox slightly more advanced example */ | |
| body { margin: 0; } | |
| .canvas { | |
| background: hotpink; | |
| width: 100vw; | |
| height: 100vh; | |
| display: flex; /* This does all the magic!!! */ | |
| justify-content: flex-end; /* position items along the MAIN axis - default: horizontal */ | |
| align-items: flex-end; /* position items along the CROSS axis - default: stretch */ | |
| flex-direction: row; /* flow of items - default: row */ | |
| flex-wrap: nowrap; /* whether they stay on one line or are shunted to the next - default: nowrap (yo!) */ | |
| /* flex-flow: row wrap; shorthand for flex-direction and flex-wrap */ | |
| } | |
| .box { | |
| background: white; | |
| /* height: 100px; */ | |
| border: 1px solid black; | |
| text-align: center; | |
| line-height: 100px; | |
| } | |
| .box1 { order: 3; flex-basis: 20%;} /* Order has to do with the placement along the MAIN axis */ | |
| .box2 { order: 4; flex-basis: 10%;} | |
| .box3 { order: 1; flex-basis: 20%;} | |
| .box4 { order: 2; flex-basis: 20%;} |
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
| <section class="canvas"> | |
| <div class="box box1">1</div> | |
| <div class="box box2">2</div> | |
| <div class="box box3">3</div> | |
| <div class="box box4">4</div> | |
| </section> |
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
| // alert('Hello world!'); |
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
| {"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment