<div class="card__wrap">
<div class="card">
<img src="https://i.imgur.com/BfuUFAI.jpeg" />
<div class="card__overlay">
<h1> Hazbin Hotel </h1>
<p>
<img src="https://i.imgur.com/sZqthig.png" />
</p>
</div>
</div>
<div class="card__shadow"> </div>
</div>
// Inspired by: https://www.youtube.com/watch?v=6xNcXwC6ikQ
// And: https://www.youtube.com/watch?v=5DEq5cWNYt8&t=11s
body {
background-color: black;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
font-family: Helvetica, Arial;
.card__wrap {
position: relative;
.card {
max-width: 300px;
aspect-ratio: 4/5;
border-radius: 10px;
overflow: hidden;
position: relative;
transition: 0.5s;
> img {
width: 100%;
height: 100%;
object-fit: cover;
}
&__overlay {
width: 100%;
position: absolute;
top: calc(90% - 15px);
display: flex;
flex-direction: column;
align-items: center;
transition: inherit;
h1 {
width: 100%;
color: white;
margin: 0px;
text-align: center;
transition: inherit;
}
img {
max-width: 100%;
transform: scale(0.6);
filter: drop-shadow(0px 5px 0px rgb(255, 0, 72, 0.33));
filter: drop-shadow(0px 5px 0px rgb(255, 0, 72, 0.33));
transition: 0.5s;
}
}
&:hover {
transition-delay: 0.5s;
transform: translateY(-10%) scale(1.05);
& ~ .card__shadow {
opacity: 1;
}
.card__overlay {
h1 {
animation: bounce 1s;
transform: translateY(100px) rotate(0deg);
}
img {
filter: drop-shadow(0px 10px 0px rgb(255, 0, 72, 0.33));
filter: drop-shadow(0px 10px 0px rgb(255, 0, 72, 0.33));
transition-delay: 0.5s;
transform: translateY(-110%) scale(1);
}
}
}
}
.card__shadow {
opacity: 0;
max-width: 300px;
width: 100%;
height: 100px;
background-color: rgb(255, 0, 72, 0.43);
position: absolute;
bottom: 0;
z-index: -1;
transform: perspective(20px) rotateX(35deg) scale(0.25, 0.35);
filter: blur(20px);
transition: 1s;
}
}
}
@keyframes bounce {
0% {
transform: translateY(0%);
}
40% {
transform: translateY(-10px);
}
55% {
transform: translateY(-7px);
}
100% {
transform: translateY(100px);
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.