JSFiddle - React, Tailwind, and code Playground
by Gwyn Milcote
HTML
<div class="container">
<div class="flex side">
<div class="fixed">
This content should not scroll
</div>
</div>
<div class="flex content">
<div>
<p>Scrolling Content</p>
<p>Scrolling Content</p>
<p>Scrolling Content</p>
<p>Scrolling Content</p>
<p>Scrolling Content</p>
<p>Scrolling Content</p>
</div>
</div>
</div>
CSS
html, body {
padding: 0;
margin: 0;
}
div {
box-sizing: border-box;
}
.container {
display: flex;
flex-direction: row;
min-height: 100%;
align-items: stretch;
}
.flex {
display: flex;
}
.side {
background: yellow;
z-index:5;
width: 200px;
padding:5px;
}
.content {
width: calc(100% - 200px);
background: green;
padding: 1rem;
height: 2000px;
}
.fixed {
position: fixed;
width: 200px;
}
@media (max-width: 600px) {
.container {flex-direction:column;}
.side {min-height:40px;max-height:60px;}
.fixed, .side {width:100%}
}