Pada snippet ini, akan menggunakan efek zoom pada image dan caption ditampilkan satu persatu.
<div class="container">
<img src="https://skillplus.web.id/wp-content/uploads/2021/10/tori-on-water.jpg"/>
<div class="caption">
<h2>Itsukushima Shrine – Hiroshima</h2>
<p>Known by its 16-meter brilliant vermillion otorii gate that seemingly floats amidst the Seto Inland Sea at high tide, this Shinto shrine sits along the crescent beach of Itsukushima Island, just 10-km southwest of Hiroshima City.</p>
<a href="#">Read More</a>
</div>
</div>
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Lato', sans-serif;
background-color: #212121;
}
.container {
width: 450px;
height: 300px;
position: relative;
}
.container img {
width: 100%;
}
.container:before {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
content: '';
background-color: #2d3436;
opacity: 0.8;
}
.caption {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
color: white;
text-transform: uppercase;
}
h2 {
text-align: center;
font-size: 17px;
padding: 20px;
margin-top: 20px;
background: rgba(0, 0, 0, 0.8);
}
p {
font-size: 16px;
width: 80%;
align-self: center;
text-align: center;
}
a {
text-decoration: none;
background: #000;
color: #fff;
width: 100px;
padding: 15px;
margin-bottom: 20px;
align-self: center;
}
/* hovering effect goes here */
.container {
background-color: #444;
border: 10px solid white;
overflow: hidden;
}
img {
transition: all 0.5s;
}
.container:hover img {
transform: rotate(720deg) scale(0);
opacity: 0;
}
.container:before {
background-color: #006266;
opacity: 0;
transition: all 0.3s;
}
.container:hover:before {
opacity: 1;
transition-delay: 0.5s;
}
a {
transform: translateY(-300px);
transition: all 0.2s;
}
.container:hover a {
transform: translateY(0);
transition-delay: 0.5s;
}
p {
transform: translateY(-300px);
transition: all 0.2s;
}
.container:hover p {
transform: translateY(0);
transition-delay: 0.7s;
}
h2 {
transform: translateY(-300px);
transition: all 0.2s;
}
.container:hover h2 {
transform: translateY(0);
transition-delay: 0.9s;
}