iOS Safari does not support CSS transforms when applied to parent elements

As a workaround, I decided to create a mockup of the scenario since developing a testable version wasn't straightforward. However, here is the gist of the issue:

@keyframes mainFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-3rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

// If I use this, without the transform, then everything works.
// 
// @keyframes mainFadeIn {
//   0% {
//     opacity: 0;
//   }
// 
//   100% {
//     opacity: 1;
//   }
// }

.main {
  animation-name: mainFadeIn;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timing-function: linear;
  background-color: gray;
  width: 100%;
  height: 16rem;
  padding: 3rem;
}

.card {
  transition: transform 500ms;
  transform-style: preserve-3d;
  -webkit-transform-origin: 50% 50%;
  perspective: 200px; // Ignore
  margin: auto;
  width: 30rem;
  height: 10rem;
  background-color: lightblue;
  
  &.flipped {
    transform: rotateY(-180deg);
  }
}

.front,
.back {
  backface-visibility: hidden;
}

.back {
  transform: rotateY(-180deg);
}
<div class="main">
  <div class="card">
    <div class="front"></div>
    <div class="back"></div>
  </div>
</div>

Hopefully this provides enough context to pinpoint the problem.

CodePen: https://codepen.io/anon/pen/owvqQP/

EDIT Well. It's probably this thing: css z-index lost after webkit transform translate3d

But I still can't get it to work. The only solution would be to use position: relative; and top: 0; and top: -3rem; for the animations..

Answer №1

It appears that the -webkit- prefix was overlooked. It is also advisable to utilize translate3d for hardware acceleration. Consider implementing the following approach:

@-webkit-keyframes mainFadeIn {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, -3rem, 0);
    transform: translate3d(0, -3rem, 0);
  }

  100% {
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}
@keyframes mainFadeIn {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, -3rem, 0);
    transform: translate3d(0, -3rem, 0);
  }

  100% {
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}

.main {
  -webkit-animation-name: mainFadeIn;
  -webkit-animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  -webkit-animation-timing-function: linear;
  animation-name: mainFadeIn;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timing-function: linear;
  background-color: gray;
  width: 100%;
  height: 16rem;
  padding: 3rem;
}

.card {
  transition: -webkit-transform 500ms;
  -webkit-transform-style: preserve-3d;
  transition: transform 500ms;
  transform-style: preserve-3d;
  -webkit-transform-origin: 50% 50%;
  -webkit-perspective: 200px; // Ignore
  perspective: 200px; // Ignore
  margin: auto;
  width: 30rem;
  height: 10rem;
  background-color: lightblue;

  &.flipped {
    -webkit-transform: rotateY(-180deg);
    transform: rotateY(-180deg);
  }
}

.front,
.back {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.back {
  -webkit-transform: rotateY(-180deg);
  transform: rotateY(-180deg);
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Development of "individual profiles"

This is my first time venturing into web app development and everything is quite unfamiliar to me. I have successfully set up a couple of PHP scripts to interact with an SQL database for user login and registration purposes. However, I now wish to implem ...

There seems to be an issue with the Angular QuickStart project as it is not functioning properly, showing the error message "(

After following the instructions in this guide for setting up VS2015, I encountered issues when trying to run the "quick start" project or the "tour of heroes" tutorial on Google Chrome. The error message I received can be found here: Angular_QuickStart_Er ...

The Chrome browser's default stylesheet is overriding the styles of my website

I'm experiencing an issue with the CSS styling on one of my website pages. Here is the CSS code for formatting links: a:link, a:visited, a:active { color: white; text-decoration: none; font-weight: bold; } However, despite these styles, ...

Is there a way to eliminate the bottom border using CSS?

I've been working with bootstrap and I managed to customize the accordion to fit into a table format. Everything is working perfectly except for a small issue with the icon displaying a border-bottom when toggled open. I've tried troubleshooting, ...

Unable to align text in the middle of the header

Seeking help with my design flaws, I have created a fiddle to showcase the issues that arise when attempting to make it responsive. The main problem is that the HEADING IN CENTER text is not aligned properly in the center. If I remove the position attribut ...

Dividing a pair of CSS stylesheets on a single HTML page

Currently, I am working on a HTML page that includes multiple javascripts and css files in the header section. <link href="@Url.Content("~/Content/css/main.css")" rel="stylesheet" type="text/css" /> In order to make the website mobile-friendly, I s ...

Modify the h:outputText value dynamically with the power of jQuery!

Is it possible to use jQuery to dynamically change the value of my OutputText component? This is the code snippet for my component: <h:outputText id="txt_pay_days" value="0" binding="#{Attendance_Calculation.txt_pay_days}"/> I would apprecia ...

Responsive design parameters

After creating a media query specifically for phones, I realized that I needed one for desktop as well. @media screen and (max-device-width: 480px), screen and (max-width: 480px) { ...css here... body {width:50%;} However, when I attempted to add a sim ...

Is there a way to load and play different sounds on multiple audio players based on the length of an array?

I am attempting to load various sounds (.mp3 audio) on separate audio players that are displayed on a single HTML page. The number of players displayed on the screen is determined by the length of the array. In this specific example, I have 3 elements in t ...

Hamburger icon is failing to appear in the collapsed navbar for certain items

My React application is not displaying the items of the collapsed navbar when using the Bootstrap navbar for mobile responsiveness. Can anyone please suggest what might be wrong here? <!-- Bootstrap 4.1.3 library --> <link rel="stylesheet" href ...

Tips for creating a hover-activated dropdown menu

How can I create a drop-down menu in my horizontal navigation bar that appears when hovering over the Columns tab? The drop-down menu should include options such as Articles, Videos, Interview, and Fashion. To better illustrate what I am looking for, here ...

Looking to retrieve the values of a 3-level dropdown using ajax. Successfully fetched the value of the 1st dropdown, but unsure of how to retrieve the values of the 2nd and

I have successfully managed to retrieve all values, but when the 2nd and 3rd drop-downs are populated through Ajax, how can I access those values? I am looking for a way to fetch the values of the 2nd and 3rd drop-down without resorting to session variable ...

How can I modify the CSS of every fourth element using jQuery?

Is there a way for jQuery to update the styling of every fourth item (div) within another div? I've been searching without success... Any guidance would be greatly appreciated :) ...

There seems to be an issue with the pseudo-elements :before and :after

I have been attempting to apply a double border to my table using the "border" property for one, and :before and :after for the second. However, I am facing an issue as it is not working properly. I am relatively new to CSS and HTML and have tried my bes ...

Issues with clicking on the ion-tab icon in AngularJS are hindering the functionality

I'm currently facing a challenge with an ion-tab icon in my AngularJS project. I've been attempting to add a click action using the code below, but unfortunately, nothing is displaying as expected. HTML <ion-tab title="Share" icon="icon ion- ...

Tailwind CSS Sturdy Top Navigation Bar

I have been attempting to implement a Fixed Navigation Bar using Tailwind CSS and have the main page scroll with a sticky effect, but I'm encountering difficulties in getting it to function properly... Here is the current state of my progress: https ...

Moving divs to a separate line in mobile display

I currently have a basic image-thumbnails landing page set up like this: <div style="display: inline-block;"><img style="margin: 3px 3px;" src="..." alt="" width="200" height="200" /></div> <div style="display: inline-block;"><i ...

The menu icon in the Bootstrap 5 navigation bar is not functioning on a specific webpage

I am facing an issue with my menu icon not working properly on mobile devices or when I try to inspect the page and run it on a responsive device. How can I resolve this problem so that users can click on the menu icon to view the navigation items? &l ...

The function I created is having trouble connecting to the controller.js file

My JavaScript controller file function ServicesCtrl($scope) { console.log("Greetings from ServicesCtrl"); $scope.message = "Hello!"; } The main HTML file <html> <head> <title>The Complete Web Development Stack</ti ...

Incorporating URL-linked images within Django

Is there an easy method to insert images into URLs in Django similar to this example? <img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." /> I need to display multiple small images and I think this approach could b ...