A Pen by Swati Kothari on CodePen.
Created
July 29, 2020 09:02
-
-
Save swati16/6153c6ad69c808cbe233b3b59cd2e2cd to your computer and use it in GitHub Desktop.
2-column CSS Flexbox layout
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
<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> |
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; | |
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