Recently, I worked on a bootstrap website where I implemented a unique feature – a card that flips to show its backside upon hover. You can check out the live website here: Live Site
Here's the code snippet for the section with the flipping card:
.niru {
max-width: 2400px;
width: 100%;
margin: 0 auto;
}
.card-container {
perspective: 1000px;
position: relative;
transform-style: preserve-3d;
width: 100%;
height: 380px;
}
.flip:hover {
transform: rotateY(180deg);
}
.card {
position: relative;
transform-style: preserve-3d;
max-width: 390px;
width: 100%;
height: 380px;
transition: all 0.8s ease;
}
.front,
.back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 380px;
background: white;
/* backface-visibility: hidden; */
transform-style: preserve-3d;
-webkit-box-shadow: 0px 7px 12px 1px rgba(0, 0, 0, 0.47);
-moz-box-shadow: 0px 7px 12px 1px rgba(0, 0, 0, 0.47);
box-shadow: 0px 7px 12px 1px rgba(0, 0, 0, 0.47);
z-index: 2;
}
.front {
transform: rotateY(0deg);
}
.back {
transform: rotateY(-180deg);
}
.card-footer {
margin: 0 auto;
}
.card-img-top {
width: 100%
}
.card-body {
padding-top: 20px;
padding-left: 20px;
padding-right: 20px;
}
.card-title {
color: black
}
.card-text {
font-weight: 800;
font-size: 17px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<section class="niru" style="background:black;">
<div class="container">
<div class="section-title">
<h2 class="title" style="color:white;padding-top:2%">
THE BEST FOLIO
</h2>
</div>
<div class="row">
<!-- Card 1 -->
<div class="col-md-4 col-sm-6">
<div class="card-container" style="height:210px">
<div class="card flip " style="height:210px">
<!-- Front -->
<div class="front" style="height:210px">
<div class="card-body">
<p class="card-title">21-12-2021 / <a style="color:#fe3e6b">CREATIVE</a></p>
<h3 class="card-text">Small project description goes here</h3>
</div>
</div>
<!-- Back -->
<div class="back" style="height:210px">
<div class="card-body">
<img class="card-img-top" src="https://picsum.photos/390/210?random=1">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
While testing the card flip feature, I noticed that the card is flickering a lot on hover. Sometimes it's not even displaying its backside properly, just flickering inconsistently. Can anyone please offer insight into what might be causing this issue?