I found this animation on the David Walsh blog. I actually like it! What I don’t like though is that he uses a fixed height and absolute positioned divs (frond and back). I am using Bootstrap along with Flexbox. As soon as I use the absolute propery everything is going out of place, when I dont use the absolute property and hover the front, the back div is ending up under the front div. This is my HTML:
<section class="content">
<div class="container">
<div class="col-md-3 col-sm-6 flip-container" ontouchstart="this.classList.toggle('hover');">
<div class="flipper">
<div class="col front">.......</div>
<div class="col back">.......</div>
</div>
</div>
// another 3 columns
</div>
</div>
And this is what I have in my CSS so far:
.featured-services
{
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.featured-services .flip-container
{
margin: 0 !important;
perspective: 1000px;
}
.flip-container:hover .flipper, .flip-container.hover .flipper {
transform: rotateY(180deg);
}
.flip-container .flipper
{
transition: 0.7s;
transform-style: preserve-3d;
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.col {
flex: 1;
padding: 10px 5px;
text-align: center;
}
.front, .back {
height: 100% !important;
backface-visibility: hidden;
}
.front
{
z-index: 2;
transform: rotateY(0deg);
background: #FFFFFF;
}
.back
{
transform: rotateY(180deg);
background: RGB(237,31,36);
color: #FFF !important;
}
Note: this is without the fixed height and absolute positioned frond and back. But like I said when I hover it the back ends up under the front. Is there any other way to accomplish this flip effect without the fixed height and absolute positioned divs.? Thank you in advance