<div class="card">
<div class="card-bg incline">
<img class="bg-img" src="https://i.imgur.com/h8tegSV.jpg" alt="" />
</div>
<img class="overlay-img" src="https://i.imgur.com/wOEA4L8.png" alt="" />
<div class="card-shadow incline"></div>
<img src="https://i.imgur.com/k7bJB9A.png" class="logo-img" alt="" />
</div>
/* INSPIRED BY: https://codepen.io/gayane-gasparyan/details/wvxewXO */
$transition-time: 0.5s;
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background-color: rgb(0, 20, 91);
}
.card {
width: 50%;
max-width: 350px;
aspect-ratio: 4/5;
position: relative;
border-radius: 10px;
img {
vertical-align: middle;
}
.overlay-img,
.logo-img {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
opacity: 0;
transition: $transition-time;
}
.logo-img {
opacity: 1;
width: 90%;
margin-inline: 5%;
}
&-bg {
width: 100%;
height: 100%;
transition: $transition-time;
position: relative;
border-radius: inherit;
.bg-img {
width: 100%;
height: 100%;
object-fit: cover;
position: relative;
border-radius: inherit;
}
}
&-shadow {
opacity: 0.5;
background: linear-gradient(
0deg,
rgba(0, 12, 56, 1) 25%,
rgba(0, 0, 0, 0) 100%
);
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
transition: $transition-time;
border-radius: inherit;
}
&:hover {
.card-bg {
box-shadow: 0px 30px 15px 0px rgb(0, 0, 0, 0.52);
box-shadow: 0px 20px 15px -10px rgb(0, 0, 0, 0.52);
filter: blur(3px);
}
.incline {
$base-transform: perspective(800px) rotateX(25deg);
transform: $base-transform;
&.card-shadow {
transform: $base-transform scale(1.02);
}
}
.overlay-img {
opacity: 1;
bottom: 30%;
transform: scale(1.1);
}
.logo-img {
bottom: 20%;
transform: scale(1.3);
}
.card-shadow {
opacity: 1;
filter: blur(5px);
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.