We can flip a image horizontally in css. We can rotate the image with 3D animated flip. Here is the full step by step working code.
HTML
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<img src="your_image.jpg" alt="img" style="width:400px;height:400px">
</div>
<div class="flip-box-back">
<h2>Paris</h2>
<p>Your back text here</p>
</div>
</div>
</div>
CSS
.flip-box {
background-color: transparent;
width: 300px;
height: 200px;
border: 1px solid #f1f1f1;
perspective: 1000px;
}
.flip-box-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-box:hover .flip-box-inner {
transform: rotateY(180deg);
}
.flip-box-front, .flip-box-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.flip-box-front {
background-color: #bbb;
color: black;
}
.flip-box-back {
background-color: #555;
color: white;
transform: rotateY(180deg);
}
Be the first to post a comment.