Skip to content

Instantly share code, notes, and snippets.

@swati16
Created July 29, 2020 09:02
Show Gist options
  • Save swati16/6153c6ad69c808cbe233b3b59cd2e2cd to your computer and use it in GitHub Desktop.
Save swati16/6153c6ad69c808cbe233b3b59cd2e2cd to your computer and use it in GitHub Desktop.
2-column CSS Flexbox layout
<div class="wrapper">
<header class="header">Header: Fixed height</header>
<section class="content">
<div class="columns">
<main class="main">Content: Flexible width</main>
<aside class="sidebar">Sidebar: Fixed width</aside>
</div>
</section>
<footer class="footer">Footer: Fixed height</footer>
</div>
body{
margin: 0;
color: #fff;
}
.wrapper{
min-height: 100vh;
background: #ccc;
display: flex;
flex-direction: column;
}
.header, .footer{
height: 50px;
background: #666;
}
.content {
flex: 1;
background: #999;
display: flex;
color: #000;
}
.columns{
display: flex;
width: 100vw;
}
.main{
flex: 3;
background: #eee;
}
.sidebar{
background: #ccc;
flex:1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment