JSFiddle - React, Tailwind, and code Playground
HTML
<button>Start</button>
<div>
<h1>Hi, I'm centerized</h1>
</div>
CSS
div {
position:absolute;
overflow:hidden;
top:100%;
right:0;
bottom:0;
left:0;
background:black;
color:white;
}
h1 {
position:fixed;
color:red;
top:50%;
left:0;
right:0;
text-align:center;
transform:translateY(-50%);
}
.animate div {
animation-name:ani;
animation-duration:2s;
}
@keyframes ani {
0% {
top:100%;
}
100% {
top:0%;
}
}
JavaScript
$$('button').first().on('click', function(e){ $$('body').first().toggleClassName('animate'); });