JSFiddle - React, Tailwind, and code Playground

HTML

<div class="wrap">
	<div class="fixed"></div>
</div>
<div class="cover"></div>

CSS

.cover{
    z-index: 10;
	width: 100%;
	height: 1000px;
	background: #fff;
}
.wrap{
	position: relative;
    z-index: 1;
    
	width: 100%;
	height: 300px;
}
.fixed{
	position:fixed;
	display: block;
    z-index: 1;
    
    left: 8px;
    right: 8px;
	height: 300px;
	background: #ccc;
}