<div class="page-wrap">
<header class="header">
<h1>Header goes here</h1>
</header>
<div class=" sidebar left-sidebar">
<nav class="side-nav">
<h2>Header here</h2>
<ul>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
<li><a href="#">Lots of menu items</a></li>
</ul>
</nav>
</div>
<div class="content">
<h2>Main Content</h2>
<p>main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : </p>
<p>main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : </p>
<p>main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : </p>
<p>main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : main content goes here : </p>
</div>
<footer class="footer">
<p>Footer content goes here</p>
</footer>
</div>
html,
body {
margin: 0;
padding: 0;
height: 100%;
font-family: sans-serif;
}
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
.page-wrap {
max-width: 2100px;
min-height: 100%;
background: #f9f9f9;
padding: 10px;
margin: auto;
display: grid;
gap: 1rem;
grid-template-columns: 320px 1fr;
grid-template-rows: auto 1fr auto;
grid-template-areas:
"fixed header"
"fixed main"
"fixed footer";
}
.header {
grid-area: header;
}
.left-sidebar {
grid-area: fixed;
}
.content {
grid-area: main;
}
.footer {
grid-area: footer;
}
.content,
.header,
.footer {
background: #ccc;
border: 5px solid red;
padding: 10px;
}
.left-sidebar {
padding: 0;
}
/* side nav */
.side-nav {
position: fixed;
bottom: 10px;
top: 10px;
width: 310px;
z-index: 99;
background: teal;
overflow: auto;
border: 5px solid red;
}
.side-nav h2 {
position: -webkit-sticky; /* needed for ios*/
position: sticky;
top: 0;
background: rgba(0, 0, 0, 0.8);
color: #fff;
padding: 1rem;
font-size: 1rem;
margin: 0;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}
.side-nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.side-nav a {
text-decoration: none;
color: #eee;
display: block;
border-bottom: 1px solid #000;
padding: 1rem;
}
.side-nav a:hover {
background: #000;
color: #fff;
}
@media screen and (max-width: 980px) {
.page-wrap {
grid-template-columns: auto;
grid-template-areas:
"header"
"main"
"footer";
}
.sidebar {
display: none;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.