Skip to content

Instantly share code, notes, and snippets.

@Linux249
Created July 16, 2018 14:20
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 Linux249/13581ca0cfc46011d9d2547a58ae6fa4 to your computer and use it in GitHub Desktop.
Save Linux249/13581ca0cfc46011d9d2547a58ae6fa4 to your computer and use it in GitHub Desktop.
scrollable middle container
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test fixed and scrolling divs in a flexbox layout</title>
<style>
* {
border: 0;
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
background-color: green;
height: inherit;
}
div.container {
flex: auto;
display: flex;
flex-direction: column;
max-height: 100%;
}
div.fixed {
flex: none;
height: 36px;
}
div.scrolling {
flex: auto;
overflow-y: auto;
background-color: purple;
}
div.left {
width: 5rem;
background-color: #333333;
}
div.body {
display: flex;
}
</style>
</head>
<body>
<div class="container">
<div class="fixed">
Fixed top section
</div>
<div class="body">
<div class="scrolling">
<p>
Scrolling middle
</p>
<p>
Scrolling middle
</p>
<p>
Scrolling middle
</p>
<p>
Scrolling middle
</p>
<p>
Scrolling middle
</p>
<p>
Scrolling middle
</p>
<p>
Scrolling middle
</p>
</div>
<div class="left">te</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment