Skip to content

Instantly share code, notes, and snippets.

@willwright82
Last active May 18, 2017 10:02
Show Gist options
  • Select an option

  • Save willwright82/cd6a35ce707338b06b36299871a9114b to your computer and use it in GitHub Desktop.

Select an option

Save willwright82/cd6a35ce707338b06b36299871a9114b to your computer and use it in GitHub Desktop.
Simple responsive flexbox grid
<style type="text/css" media="all">
body {
margin: 0;
}
.container {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.flex-grid {
display: flex;
flex-direction: column;
align-items: stretch;
height: 100%;
}
.col {
flex: 1;
padding: 15px; /* Styling */
}
footer {
align-self: stretch;
padding: 15px; /* Styling */
background: lightgrey; /* Styling */
min-height: 70px; /* Styling */
}
@media (min-width: 600px) {
.container {
height: 100vh;
}
.flex-grid {
flex-direction: row;
}
}
</style>
<div class="container">
<div class="flex-grid">
<div class="col"></div>
<div class="col" style="background: lightblue;"></div>
<div class="col"></div>
</div>
<footer></footer>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment