JSFiddle - React, Tailwind, and code Playground
HTML
<!-- div1 div2 -->
<div class="wrapper">
<div class="div1">div1</div>
<div class="div2">div2</div>
</div>
CSS
/* div1 div2 */
.wrapper {
position: relative;
width: 100%;
height: 200px;
}
.div1,
.div2 {
position: absolute;
left: 0;
top: 0;
right: auto;
bottom: auto;
width: 100%;
height: 100%;
}
.div1 {
background: green;
z-index: 10;
}
.div2 {
with: 90%;
}
.div2 {
background: blue;
z-index: 20;
}
JavaScript
/* div1 div2 */