'Why isn't backface-hidden working on iPhone?
I have this code.
HTML:
.flip-card {
background-color: transparent;
width: 300px;
height: 376px;
perspective: 1000px;
border-radius: 1rem;
margin: 0 auto 1.5rem;
transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner,
.flip-card:active .flip-card-inner {
transform: rotateY(180deg);
}
.flip-card-front,
.flip-card-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
/* Safari */
backface-visibility: hidden;
}
.flip-card-front {
background-color: #bbb;
color: black;
}
.flip-card-back {
background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(44, 52, 145, 0.5) 100%), var(--secondary);
color: white;
transform: rotateY(180deg);
border-radius: 1rem;
box-shadow: 0 4px 2rem rgba(0, 0, 0, 0.5);
}
.flip-card-back p {
font-size: 16px;
padding: 1.5rem;
margin-top: 3rem;
color: #333;
}
.avatar {
width: 250px;
position: relative;
top: 0;
left: 0;
z-index: 1;
backface-visibility: hidden !important;
margin: auto;
border-radius: .75rem;
}
.avatar img {
backface-visibility: hidden !important;
}
.flip-card-front {
background-color: #fff;
color: black;
border-radius: 1rem !important;
backface-visibility: hidden !important;
box-shadow: 0 0 1rem rgba(0, 0, 0, 0.125);
padding: 1rem;
}
.flip-card-inner {
position: relative;
width: 280px;
height: auto;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
border-radius: 1rem;
min-height: 360px;
}
.nameCharge {
position: relative;
z-index: 200;
top: 0;
left: 0;
display: block;
backface-visibility: hidden !important;
padding: 1rem 0;
}
.nameCharge h3 {
text-transform: capitalize;
font-family: 'Montserrat', Helvetica, sans-serif;
font-size: 18px;
color: #1F5CE5;
font-weight: 600;
margin: 0;
backface-visibility: hidden;
text-align: left;
}
.nameCharge h4 {
font-size: 12px;
text-align: left;
font-weight: 600;
color: #3b3b3b;
}
<div class="flip-card ">
<div class="flip-card-inner ">
<div class="flip-card-front ">
<img src="https://via.placeholder.com/300" alt="blah" class="avatar ">
<div class="nameCharge ">
<h3>The Name</h3>
<h4>The Position</h4>
</div>
</div>
<div class="flip-card-back ">
<p>text text text</p>
</div>
</div>
</div>
This code works fine on desktop devices, but for some reason, on iPhone the front image is visible when I flip the card. I could reproduce this behavior on iPhone, Android seems to work as expected
What am I missing here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
