Skip to content

Instantly share code, notes, and snippets.

@vastus
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save vastus/f189b717cd52f6f649ee to your computer and use it in GitHub Desktop.

Select an option

Save vastus/f189b717cd52f6f649ee to your computer and use it in GitHub Desktop.
Three column layout w/ CSS Flexbox -- http://sassmeister.com/gist/f189b717cd52f6f649ee
<div class="layout">
<div class="nav col">
<h3>Menu</h3>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="content col">
<h1>Main</h1>
</div>
<div class="sidebar col">
<h3>Sidebar</h3>
<p>
Lorem ipsum dolor sit amet...
</p>
</div>
</div>
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
.layout {
color: #333;
font-family: sans-serif;
display: flex;
min-height: 100vh;
}
a {
color: #44d;
font-size: 14px;
font-weight: bold;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
.col {
padding: 1em;
}
.nav {
flex: 1;
//background: honeydew;
}
.content {
flex: 3;
border-left: 1px solid #eee;
border-right: 1px solid #eee;
//background: peachpuff;
}
.sidebar {
flex: 1;
//background: lightblue;
}
@media (max-width: 480px) {
.layout {
display: block;
}
}
.layout {
color: #333;
font-family: sans-serif;
display: flex;
min-height: 100vh;
}
a {
color: #44d;
font-size: 14px;
font-weight: bold;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.col {
padding: 1em;
}
.nav {
flex: 1;
}
.content {
flex: 3;
border-left: 1px solid #eee;
border-right: 1px solid #eee;
}
.sidebar {
flex: 1;
}
@media (max-width: 480px) {
.layout {
display: block;
}
}
<div class="layout">
<div class="nav col">
<h3>Menu</h3>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="content col">
<h1>Main</h1>
</div>
<div class="sidebar col">
<h3>Sidebar</h3>
<p>
Lorem ipsum dolor sit amet...
</p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment