JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="card">
<textarea rows="6" placeholder="Not highlighted"></textarea>
<textarea rows="6" class="is-highlighted" placeholder="Highlighted"></textarea>
<div class="overlay"></div>
</div>
</div>
CSS
.container {
padding: 2rem;
background-color: rgb(239, 96, 48);
}
@keyframes slide-down {
0% {
transform: translate(0, -1rem);
}
100% {
transform: translate(0, 0);
}
}
.card {
padding: 1rem;
background-color: white;
animation: slide-down 0.8s normal forwards;
}
.is-highlighted {
position:relative;
z-index:2;
}
.overlay {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
z-index: 1;
transition: 0.8s all;
}
JavaScript
let overlay = document.querySelector('.overlay');
// Ultimately, I want to make the overlay disappear after some time,
// but that's beyond the point.
/*
window.setTimeout(() => {
overlay.style.opacity = 0;
window.setTimeout(() => {
overlay.style.display = 'none';
}, 800);
}, 800);
*/