JSFiddle - React, Tailwind, and code Playground

HTML

<section class="my-position-base">
    <div class="container">
      <div class="with-after">
      </div>
    </div>
<section>

CSS

.my-position-base {position: relative;}

.container {
  width: 200px;
  height: 200px;
  border: 1px solid red;
  overflow-y: scroll; 
    
}

.with-after {
    border: 1px solid green;
    height: 50px;
    padding: 0 100px;
    position: relative;
    left:0;
    z-index: -1;
}

.with-after:after {
  content: "";
  width: 200vw;
  height: 100%;
  background: blue;
  position: absolute;
  left: 0px;
  z-index: 5;
}