Skip to content

Instantly share code, notes, and snippets.

@AlbertoMonteiro
Created April 19, 2017 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbertoMonteiro/648dfa657e8f6891aa2e7a5bb142d48b to your computer and use it in GitHub Desktop.
Save AlbertoMonteiro/648dfa657e8f6891aa2e7a5bb142d48b to your computer and use it in GitHub Desktop.
FlexBox Layout
<div class="application">
<div class="sidebar">Sidebar</div>
<div class="main">
<div class="header">Header</div>
<div class="content">
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
<h3>Content with scroll</h3>
</div>
<div class="footer">Footer</div>
</div>
</div>
.application {
padding: 1vh;
display: flex;
border: 1px solid red;
height: 94vh;
text-align: center;
font-family: Calibri;
overflow: auto;
.sidebar {
border: 1px solid blue;
color: blue;
padding: 5px;
margin-right: 5px;
min-width: 250px;
max-width: 250px;
}
.main {
border: 1px solid green;
color: green;
padding: 5px;
flex-grow: 1;
display: flex;
flex-direction: column;
.header, .content, .footer {
border: 1px solid gray;
padding: 5px;
color: gray;
}
.header, .footer { height: 30px; }
.header { border-color: brown; color: brown; }
.footer { border-color: royalblue; color: royalblue; }
.content {
flex-grow: 1;
overflow: auto;
margin: 5px 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment