JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

HTML

<div class='parent one'>
  <div class='child'>
  
  </div>
</div>
<div class='parent two'>
  <div class='child'>
  
  </div>
</div>

SCSS

.parent {
  position: absolute;
  z-index: 1;
  width: 300px;
  height: 300px;
  background: white;
  border: 1px solid darken(red, 20%);
}

.one {
  top: 50px;
  left: 10px;
  border: 1px solid green;
  
  .child {
    bottom: -5px;
  }
}

.two {
  top: 350px;
  left: 10px;
  
  .child {
    background: tomato;
  }
}

.child {
  position: absolute;
  z-index: 10 !important;
  bottom: calc(100% + 5px);
  width: 100%;
  height: 5px;
  background: black;
}