JSFiddle - React, Tailwind, and code Playground
by Asif Sharif Shahid
HTML
<div class="container">
<p tabindex="1">
Lorem ipsum...
</p>
<div class="fixedOverlay"></div>
<p class="scrollableContent">I will let you scroll..</p>
</div>
CSS
.container {
position: relative;
border: 1px solid;
margin: 10px;
width: 400px;
max-height: 300px;
overflow: auto;
}
p:focus + .fixedOverlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index:10;
}
p:focus {
color: red;
}
.scrollableContent{
position:absolute;
margin: 10px;
width: 100px;
height: 100px;
border: 1px solid;
z-index:11;
}