JSFiddle - React, Tailwind, and code Playground

by Pugazh

HTML

<div class="container">
  <div class="fixed">
    <div class="absolute">
    </div>
  </div>
</div>

CSS

.container {
  width: 100%;
  height: 500px;
  background-color: #ddd;
}

.fixed {
  position: fixed;
  width: 100%;
  height: 50px;
  background-color: red;
  top: 8px;
  left: 8px;
  right: 15px;
}

.absolute {
  position: absolute;
  height: calc(100vh - 51px);
  width: 100%;
  background-color: green;
  top: 51px;
  left: 0px;
}