Last active
June 29, 2021 22:04
-
-
Save JohnGoodman/72d2437e23923f9a72930616462222ef to your computer and use it in GitHub Desktop.
Flexbox vertical scaleable columns with overflow body content
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
<!-- Codepen: https://codepen.io/John-Goodman/pen/jOmEqqB --> | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Flex Test</title> | |
<meta name="description" content="Flex Test"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
body { | |
margin: 0px; | |
padding: 0px; | |
} | |
.horizontal-flex-wrapper { | |
display: flex; | |
justify-content: center; | |
min-height: 100vh; | |
background-color: antiquewhite; | |
} | |
.vertical-flex-wrapper { | |
display: flex; | |
flex-direction: column; | |
height: 100vh; | |
/* align-items: stretch; */ | |
/* width: 50vw; */ | |
width: 600px; | |
/* padding: 30px; */ | |
background-color:plum; | |
} | |
.flex-column { | |
/* padding: 30px; */ | |
} | |
.header { | |
height: 60px; | |
flex-shrink: 0; | |
background-color: cornflowerblue; | |
} | |
.subheader { | |
height: 30px; | |
flex-shrink: 0; | |
background-color: turquoise; | |
} | |
.body-content { | |
flex-grow: 1; | |
min-height: 200px; | |
overflow-y: scroll; | |
background-color: lavender; | |
} | |
.overflow-wrapper { | |
border: 1px solid; | |
} | |
.footer { | |
height: 60px; | |
flex-shrink: 0; | |
background-color: lightpink; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='horizontal-flex-wrapper'> | |
<div class='vertical-flex-wrapper'> | |
<div class='flex-column header'>Header</div> | |
<div class='flex-column subheader'>SubHeader</div> | |
<div class='flex-column body-content'> | |
<p>Body Content</p> | |
<div class='overflow-wrapper'> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
<p>This text will take up too much space and will need to overflow</p> | |
</div> | |
</div> | |
<div class='flex-column footer'>Footer</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment