CSS Flexible Layout Module - flex property
|
/** |
|
* 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: 20% ; |
|
} |
|
.mainContent { |
|
background-color: white; |
|
order: 3; |
|
flex: 60%; |
|
} |
|
.extraDiv { |
|
background-color: pink; |
|
order: 2; |
|
flex: 20%; |
|
} |
|
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 */ |
|
body { flex-flow: column wrap; } |
|
.mainContent, aside, footer, header, .extraDiv { |
|
/* Return them to document order and make all full width*/ |
|
order: 0; |
|
flex: none; |
|
} |
|
} |
|
<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> |
|
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |