JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="block"></div>
</div>
<button>Click</button>
CSS
.block {
position:absolute;
bottom:10px;
right:10px;
left:10px;
height:100px;
background:gray;
}
.container {
-webkit-transition: -webkit-transform ease-in-out 1s;
-webkit-transform-origin: top;
-webkit-transition-delay: 0.1s; /* Needed to calculate the vertical area to shift with translateY */
}
.container.hide {
position:absolute;
top:0;
left:0;
bottom:0;
right:0;
/* background:#f00; /* Uncomment to see the affected area */
-webkit-transform: translateY(-110%);
}
JavaScript
document.querySelector("button").addEventListener("click", function () {
document.querySelector(".container").classList.add("hide");
});