Created
July 25, 2016 01:45
-
-
Save siakaramalegos/65a10046914fc0a834debbd4cc31d432 to your computer and use it in GitHub Desktop.
Flexbox demo
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"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<header>Header</header> | |
<main> | |
<nav>Nav</nav> | |
<article> | |
<div class="tiles"> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
<div class="tile">Tile</div> | |
</div> | |
</article> | |
<aside>Aside</aside> | |
</main> | |
<footer>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
body { | |
margin: 0; | |
display: flex; | |
flex-direction: column; | |
height: 100vh; | |
} | |
main { | |
flex-grow: 1; | |
display: flex; | |
} | |
article { | |
background: gainsboro; | |
flex-grow: 1; | |
overflow: auto; | |
} | |
@media (max-width: 450px) { | |
main { | |
flex-direction: column; | |
} | |
aside { | |
order: -1 | |
} | |
} | |
.tiles { | |
display: flex; | |
flex-wrap: wrap; | |
justify-content: space-between; | |
} | |
.tile { | |
background: dodgerblue; | |
width: 100px; | |
height: 100px; | |
margin-bottom: 10px; | |
} | |
/* Other style */ | |
header { | |
background: rebeccapurple; | |
color: white; | |
text-align: center; | |
} | |
footer { | |
background: mediumseagreen; | |
} | |
nav { | |
background: aquamarine; | |
} | |
aside { | |
background: orchid; | |
} | |
header, footer, nav, article, aside { | |
padding: 5px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment