JSFiddle - React, Tailwind, and code Playground
by vadimkot
HTML
<div class="container">
<div class="preview">Preview</div>
<div class="back">Back</div>
</div>
CSS
.container {
position: relative;
width: 500px;
height: 300px;
}
.preview, .back {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.preview {
height: 100%;
background-color: red;
}
.back {
position: absolute;
top: 0;
left: 0;
height: 0;
overflow: hidden;
background-color: blue;
/* transition: height 0.5s; */
}
.container:hover .back {
height: 100%;
}