JSFiddle - React, Tailwind, and code Playground

HTML

<div class="big">
  <div class="flex">
    <div class="container">
      <div class="abs" style="top: 0px">1</div>
      <div class="abs" style="top: 20px">2</div>
      <div class="abs" style="top: 40px">3</div>
    </div>
  </div>
</div>

CSS

.big {
  display: flex;
  flex-direction: column;
  width: 100px;
  height: 40px;
}

.flex {
  display: flex;
  flex-grow: 1;
}

.container {
  height: 100%;
  flex-grow: 1;
  overflow: scroll;
  position: relative;
}

.abs {
  position: absolute;
}