Last active
April 15, 2016 03:10
-
-
Save cameck/be42a4f9920a425d89861a14c99900aa to your computer and use it in GitHub Desktop.
The Holy Grail of Layouts with Flex Box
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>This is the Holy Grail</title> | |
<link rel="stylesheet" href="css/styles.css" /> | |
</head> | |
<body> | |
<header>This is my header</header> | |
<div id="main"> | |
<section>This is some text inside a section | |
</section> | |
<nav>This is some text in a nav</nav> | |
<aside>This is some aside text</aside> | |
</div> | |
<footer>This is my footer</footer> | |
</body> | |
</html> |
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
/*Universal Styles*/ | |
* { | |
color: white; | |
} | |
/*Header Styles*/ | |
header { | |
background: blue; | |
min-height: 200px; | |
margin-bottom: 1%; | |
} | |
/*Main Section Styles*/ | |
#main { | |
display: flex; | |
min-height: 800px; | |
flex-direction: column; | |
} | |
nav { | |
background: green; | |
min-height: 100px; | |
} | |
aside { | |
background: red; | |
min-height: 100px; | |
} | |
section { | |
background: grey; | |
min-height: 600px; | |
} | |
section, nav { | |
margin-bottom: 1%; | |
} | |
/*Footer Styles*/ | |
footer { | |
background: blue; | |
min-height: 200px; | |
margin-top: 1%; | |
} | |
/*Desktop Styles*/ | |
@media screen and (min-width: 1100px) { | |
#main { | |
flex-direction: row; | |
} | |
nav { | |
width: 19%; | |
margin-right: 1%; | |
margin-bottom: 0; | |
order: -1; | |
} | |
aside { | |
width: 19%; | |
margin-left: 1%; | |
} | |
section { | |
width: 60%; | |
margin-bottom: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment