JSFiddle - React, Tailwind, and code Playground
by hcarleton
HTML
<div class="box"></div> <!-- Moved outside of relatively positioned parent -->
<div class="parent"></div>
<div class="tall"></div>
CSS
body { margin: 0; }
html {
box-sizing: border-box;
}
*, *::before, *::after {
box-sizing: inherit;
position: relative;
}
.parent {
background: rgba(0, 0, 0, .4);
height: 100px;
width: 5rem;
margin-bottom: 25px;
}
.box {
position: absolute;
top: 0;
left: 0;
height: 50px;
width: 100%; /* 100% of body width */
background: rgba(0, 0, 0, .4);
border: 2px solid red;
}
.tall {
height: 100rem;
}