JSFiddle - React, Tailwind, and code Playground

by Luckypouet

HTML

<div class="main">
  <div class="sub"></div>
  <div class="parent">
    <div class="brother">lkqfsjm ldfkjqmls djfqmlsdj kfmlqsjkd fmlqskjdf mlsqsklm </div>  
  </div>
</div>

SCSS

.main{
  position: relative;
  width: 500px;
  height: 500px;
  /* background: #FFC; */
}

.sub{
  z-index: -1;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  background: #FCF;
}

.parent{
  position: relative;
  /* height: 100%; */
  border: 1px solid red;
  /* transform: translateZ(0); */
}

.brother{
  position:relative;
  height: 150px;
  &:after{
    z-index: -2;
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    background: #CCF;
  }
}