JSFiddle - React, Tailwind, and code Playground
HTML
<div class="item">
<div class="image">
<div class="overlapping-layer">
<div class="centered">
<span>some text!</span>
</div>
</div>
</div>
<div class="description">
<div class="main">
<span class="name">Felis silvestris</span>
<span class="price">$35</span>
</div>
<div class="details">
Some weird text
</div>
</div>
</div>
CSS
/* reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
}
.item {
width: 225px;
height: 300px;
box-shadow: 0px 0px 12px 4px rgba(0,0,0,0.5);
cursor: pointer;
transition: all 0.3s ease 0s;
overflow: hidden;
}
.image {
height: 70%;
background-image: url('https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg');
background-position: center center;
background-size: cover;
position: relative;
transition: all 0.3s ease 0s;
width: 100%;
display: table;
}
.overlapping-layer {
position: relative;
opacity: 0;
color: white;
font-size: 2em;
background-color: rgba(61, 8, 20, 0.5);
transition: all 0.3s ease 0s;
display: table-cell;
text-align: center;
vertical-align: middle;
}
.centered {
/* it doesn't need no styles, lol */
}
.description {
height: 30%;
padding: 20px;
overflow: hidden;
transition: all 0.3s ease 0s;
}
.name, .price, .details {
display: block;
font-size: 1.2em;
}
.price {
font-weight: bold;
color: rgb(9, 238, 177);
}
.details {
margin-top: 12px;
opacity: 0;
transition: all 0.3s ease 0s;
}
.item:hover {
transition: all 0.6s ease 0s;
box-shadow: 0px 0px 25px 8px rgba(0,0,0,0.7);
}
.item:hover .image {
transition: all 0.6s ease 0.3s;
height: 60%;
}
.item:hover .overlapping-layer {
transition: all 0.3s ease 0.7s;
opacity: 1;
}
.item:hover .description {
transition: all 0.6s ease 0.3s;
height: 40%;
}
.item:hover .details {
transition: all 0.6s ease 0.5s;
opacity: 1;
}
/* only for demo purposes */
.item {
position: absolute;
transform: translate(-50%,-50%);
left: 50%;
top: 50%;
}