JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html lang="es">
<head>
<title>Uso de Z-index</title>
</head>
<body>
<p>Saludos cordiales! Soy un texto metiche</p>
<div class="caja" id="rojo"></div>
<p>Hola soy un segundo texto mucho más metiche</p>
<div class="caja" id="verde"></div>
<p>Hola soy un tercer texto muchísimo más metiche que mis colegas</p>
<div class="caja" id="azul"></div>
</body>
</html>
CSS
.caja{
position: absolute;
width: 200px;
height: 200px;
}
#rojo{
background: red;
top: 0;
left: 0;
z-index: 4;
}
#verde{
background: green;
top: 20px;
left: 20px;
z-index: 3;
}
#azul{
background: blue;
top: 40px;
left: 40px;
z-index: 1;
}
p{
display: block;
font-weight: bold;
font-size: 1.4em;
position: relative;
z-index: 2;
}