Created
July 14, 2017 15:10
-
-
Save danielmascena/cc0684f1ab357544f3cbd46020ed1808 to your computer and use it in GitHub Desktop.
CSS Flexible Layout Module - flex property
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
/** | |
* CSS Flexible Layout Module - flex property | |
*/ | |
* { transition: all 2s; box-sizing: border-box;} | |
body { | |
background: #bfbfbf; | |
} | |
header,aside,.mainContent,.extraDiv,footer { | |
padding: 1em; | |
font-size: 1.4em; | |
} | |
body { | |
background: #bfbfbf; | |
display: flex; | |
flex-wrap: wrap; | |
} | |
header { | |
background-color: blue; | |
order: 5; | |
flex: 100%; | |
color: white; | |
} | |
aside { | |
background-color: orange; | |
order: 4; | |
flex: 1 ; | |
} | |
.mainContent { | |
background-color: white; | |
order: 3; | |
flex: 2; | |
} | |
.extraDiv { | |
background-color: pink; | |
order: 2; | |
flex: 1; | |
} | |
footer { | |
background-color: green; | |
order: 1; | |
flex: 100%; | |
} | |
@media all and (max-width: 500px) { | |
footer { | |
order: 5; | |
} | |
header { | |
order: 1; | |
} | |
} | |
@media all and (max-width: 400px) { | |
/* change below 400px */ | |
.mainContent, aside, footer, header, .extraDiv { | |
/* Return them to document order and make all full width*/ | |
order: 0; | |
flex: none; | |
} | |
} |
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
<header role="banner">here is the header</header> | |
<div class="mainContent">Here is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main contentHere is the main content</div> | |
<aside role="complementary">here is a sidebar, after the main content (although we want to make it appear before)</aside> | |
<div class="extraDiv">Oh Lord, now my head is starting to hurt!</div> | |
<footer role="contentInfo">here is the main footer</footer> |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment