CSS3 transform not displaying well in Microsoft Edge (and IE) - html

Fairly new web developer here. So I have a CSS3 transition on my wordpress site which works fine in every browser but IE and Edge. Not sure exactly what to do about it also since I am not easily able to test it on my mac.
Here are the snippets that may be effecting things. The first is starting them off the page.
.jumbotron #name {
margin-left:-200em;
}
.jumbotron #line {
margin-left:-80em;
}
.jumbotron #occupation1, .jumbotron #occupation2 {
margin-left:-190em;
}
#-webkit-keyframes slideInLeft {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(42%, 0, 0);
transform: translate3d(42%, 0, 0);
}
}
#keyframes slideInLeft {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(42%, 0, 0);
transform: translate3d(42%, 0, 0);
}
}
#-webkit-keyframes slideInLeftLine {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(315%, 0, 0);
transform: translate3d(315%, 0, 0);
}
}
#keyframes slideInLeftLine {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(315%, 0, 0);
transform: translate3d(315%, 0, 0);
}
}
#-webkit-keyframes slideInLeft2 {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(43%, 0, 0);
transform: translate3d(43%, 0, 0);
}
}
#keyframes slideInLeft2 {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(43%, 0, 0);
transform: translate3d(43%, 0, 0);
}
}
#-webkit-keyframes slideInLeft3 {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(45%, 0, 0);
transform: translate3d(45%, 0, 0);
}
}
#keyframes slideInLeft3 {
from {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(45%, 0, 0);
transform: translate3d(45%, 0, 0);
}
}
.slideInLeft3 {
-webkit-animation-name: slideInLeft3;
animation-name: slideInLeft3;
}
.slideInLeft {
-webkit-animation-name: slideInLeft;
animation-name: slideInLeft;
}
.slideInLeft2 {
-webkit-animation-name: slideInLeft2;
animation-name: slideInLeft2;
}
.slideInLeftLine {
-webkit-animation-name: slideInLeftLine;
animation-name: slideInLeftLine;
}
#name {
opacity:1;
animation: slideInLeft 2s 1;
-webkit-animation: slideInLeft 2s 1;
-moz-animation: slideInLeft 2s 1;
-webkit-animation-fill-mode: forwards; /* Chrome, Safari, Opera */
animation-fill-mode: forwards;
}
#line {
opacity:1;
animation: slideInLeftLine 2s 1;
-webkit-animation: slideInLeftLine 2s 1;
-moz-animation: slideInLeftLine 2s 1;
-webkit-animation-delay: 2s; /* Chrome, Safari, Opera */
animation-delay: 2s;
-webkit-animation-fill-mode: forwards; /* Chrome, Safari, Opera */
animation-fill-mode: forwards;
}
#occupation2 {
animation: slideInLeft3 2s 1;
-webkit-animation: slideInLeft3 2s 1;
-moz-animation: slideInLeft3 2s 1;
-webkit-animation-delay: 5s; /* Chrome, Safari, Opera */
animation-delay: 5s;
-webkit-animation-fill-mode: forwards; /* Chrome, Safari, Opera */
animation-fill-mode: forwards;
}
#occupation1 {
animation: slideInLeft2 2s 1;
-webkit-animation: slideInLeft2 2s 1;
-moz-animation: slideInLeft2 2s 1;
-webkit-animation-delay: 3s; /* Chrome, Safari, Opera */
animation-delay: 3s;
-webkit-animation-fill-mode: forwards; /* Chrome, Safari, Opera */
animation-fill-mode: forwards;
}
Really just the #line is the one that I am having trouble with. It could possibly be because the margins function differently with edge and ie? I know that the resume's on the site are not displaying center in the page either. I put the site up on a sub directory incase you want to see it.

For starters one major issue is your html. You have extra anonymous closing tags i.e. extra closing div in jumbotron and a random closing p tag in col-md-4 col-md-offset-7. I just removed the col-md-4 divs altogether
I also don't know why you are using margin-left. I personally would scrap using margin left and use absolute positioning on the items inside #jumbotron and make sure #jumbotron is relatively positioned. You will have to mess with the positions to get what you want, but this works in IE.
Html:
<div class="jumbotron">
<div id="name">
<h2>Joseph Scalzo</h2>
</div>
<div id="line"></div>
<h3 id="occupation1">Performer.</h3>
<h3 id="occupation2">Sommelier.</h3>
</div>
<main role="main">
<!-- section -->
<section>
<!-- article formerly with class bigboy -->
<article id="post-2" class="post-2 page type-page status-publish hentry">
<div class="container" id="hide" style="height:0; width:0;">
<figure>
<img src="http://joebiz.net/blog/wp-content/uploads/2015/09/jumbotron.jpg" alt="headshot1"/><br />
</figure>
<div class="col-md-4 col-md-offset-7">
<h2>Joseph Scalzo</h2>
<hr id="fixedLine">
<h3>Performer. Sommelier.</h3>
</div>
</div>
<br class="clear">
</article>
<!-- /article -->
</section>
<!-- /section -->
</main>
Css:
.jumbotron {
position: relative;
}
.jumbotron h2 {
font-size:4em;
font-family: 'Raleway', Tahoma, sans-serif;
color:#f3e877;
}
.jumbotron h3 {
font-family: 'Raleway', Tahoma, sans-serif;
color:black;
}
.jumbotron #name {
position: absolute;
top: 100px;
width: 375px;
}
.jumbotron #line {
border-bottom: 1px solid #fff;
height: 1px;
position: absolute;
top: 172px;
left: -100%;
width: 375px;
}
.jumbotron #occupation1 {
position: absolute;
top: 180px;
left: -100%;
width: 375px;
}
.jumbotron #occupation2 {
position: absolute;
top: 220px;
left: -100%;
width: 375px;
}
#-webkit-keyframes slideInLeft {
from {
left: -100%;
}
to {
left: 60%;
}
}
#keyframes slideInLeft {
from {
left: -100%;
}
to {
left: 60%;
}
}
#-webkit-keyframes slideInLeftLine {
from {
left: -100%;
}
to {
left: 60%;
}
}
#keyframes slideInLeftLine {
from {
left: -100%;
}
to {
left: 60%;
}
}
#-webkit-keyframes slideInLeft2 {
from {
left: -100%;
}
to {
left: 68%;
}
}
#keyframes slideInLeft2 {
from {
left: -100%;
}
to {
left: 68%;
}
}
#-webkit-keyframes slideInLeft3 {
from {
left: -100%;
}
to {
left: 72%;
}
}
#keyframes slideInLeft3 {
from {
left: -100%;
}
to {
left: 72%;
}
}

Related

Right to Left div and hide after 5 sec using CSS

I am displaying div from right to left and after 5 sec it will hide. I tried some code right to left is working but after 5 sec it's not hiding.
I tried opacity:0 inside keyframe but then my animation not working.
Would you help me out in this?
.successAlet {
background-color: red;
color: #fff;
position: fixed;
top: 0;
width: 400px;
right: 0;
z-index: 1001;
-webkit-animation-name: fadeInRight;
animation-name: fadeInRight;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
#-webkit-keyframes fadeInRight {
0% {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
#keyframes fadeInRight {
0% {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
<div class="successAlet">
<h2>Animate and then autohide in 5 sec</h2>
</div>
Consider a second animation. You can also simplify your code by removing a lot of non needed properties
.successAlet {
background-color: red;
color: #fff;
position: fixed;
top: 0;
width: 400px;
right: 0;
z-index: 1001;
animation-name: fadeInRight,hide;
animation-duration: 1s;
animation-delay: 0s,3s;
animation-fill-mode: both;
}
#keyframes fadeInRight {
0% {
opacity: 0;
transform: translate3d(100%, 0, 0);
}
}
#keyframes hide {
100% {
opacity: 0;
}
}
<div class="successAlet">
<h2>Animate and then autohide in 5 sec</h2>
</div>
for smooth hide
#keyframes hide {
100% {
opacity: 1;
width: 0;
}
}

Can't animate a card opening

I am trying to animate a frame where the 'heart-flap' opens to the left. But can't seem to do it -- the axis of the box and the heart is not the same while opening.
My jsFiddle https://jsfiddle.net/dk1446/unjqx08d/2/
#import url(https://fonts.googleapis.com/css?family=Poiret+One);
body {
background-color: white;
font-family: 'Poiret One', Segoe UI Light, cursive;
}
.heart {
background-color: #d32f2f;
display: inline-block;
height: 200px;
margin: 0 10px;
position: relative;
top: 0;
/* transform: rotate(-45deg); */
width: 200px;
margin-top: 200px;
margin-left: 500px;
/* transform: rotate(0deg); */
}
.heart:before,
.heart:after {
content: "";
background-color: #d32f2f;
border-radius: 50%;
height: 200px;
position: absolute;
width: 200px;
}
.heart:before {
top: -110px;
left: 0;
}
.heart:after {
left: 110px;
top: 0;
}
#card {
margin-top: 200px;
}
#message {
height: 400px;
width: 400px;
margin-top: -410px;
margin-left: 500px;
background-color: #333;
color: white;
border: 3px dashed violet;
border-radius: 35% 0 35% 0;
}
#card #heart1 {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-animation: closeLeft 2s ease-in-out forwards;
-moz-animation: closeLeft 2s ease-in-out forwards;
-ms-animation: closeLeft 2s ease-in-out forwards;
animation: closeLeft 2s ease-in-out forwards;
}
#card:hover #heart1 {
-webkit-animation: openLeft 2s ease-in-out forwards;
-moz-animation: openLeft 2s ease-in-out forwards;
-ms-animation: openLeft 2 ease-in-out forwards;
animation: openLeft 2s ease-in-out forwards;
}
#-webkit-keyframes closeLeft {
from {
-webkit-transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(180deg);
}
}
#-moz-keyframes closeLeft {
from {
-moz-transform: rotateY(0deg);
}
to {
-moz-transform: rotateY(180deg);
}
}
#-ms-keyframes closeLeft {
from {
-ms-transform: rotateY(0deg);
}
to {
-ms-transform: rotateY(180deg);
}
}
#keyframes closeLeft {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(180deg);
}
}
#-moz-keyframes openLeft {
from {
-moz-transform: rotateY(180deg);
}
to {
-moz-transform: rotateY(0deg);
}
}
#-webkit-keyframes openLeft {
from {
-webkit-transform: rotateY(180deg);
}
to {
-webkit-transform: rotateY(0deg);
}
}
#-ms-keyframes openLeft {
from {
-ms-transform: rotateY(180deg);
}
to {
-ms-transform: rotateY(0deg);
}
}
#keyframes openLeft {
from {
transform: rotateY(180deg);
}
to {
transform: rotateY(0deg);
}
}
<div id="card">
<div class="heart" id="heart1"></div>
<div id="message">
<h2>Happy Valentines Day</h2>
</div>
<!-- <div class="heart" id="heart2"></div> -->
</div>
I would like the 'heart' to open to the left and close right. It should be in line with the box underneath. I can't seem to figure out a way.
You almost had it! You need to add transform-origin: 0 0 to the #heart1
#import url(https://fonts.googleapis.com/css?family=Poiret+One);
body {
background-color: white;
font-family: 'Poiret One', Segoe UI Light, cursive;
}
.heart {
background-color: #d32f2f;
display: inline-block;
height: 200px;
margin: 0 10px;
position: relative;
top: 0;
/* transform: rotate(-45deg); */
width: 200px;
margin-top: 200px;
margin-left: 500px;
/* transform: rotate(0deg); */
}
.heart:before,
.heart:after {
content: "";
background-color: #d32f2f;
border-radius: 50%;
height: 200px;
position: absolute;
width: 200px;
}
.heart:before {
top: -110px;
left: 0;
}
.heart:after {
left: 110px;
top: 0;
}
#card {
margin-top: 200px;
}
#message {
height: 400px;
width: 400px;
margin-top: -410px;
margin-left: 500px;
background-color: #333;
color: white;
border: 3px dashed violet;
border-radius: 35% 0 35% 0;
}
#card #heart1 {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-animation: closeLeft 2s ease-in-out forwards;
-moz-animation: closeLeft 2s ease-in-out forwards;
-ms-animation: closeLeft 2s ease-in-out forwards;
animation: closeLeft 2s ease-in-out forwards;
transform-origin: 0 0;
}
#card:hover #heart1 {
-webkit-animation: openLeft 2s ease-in-out forwards;
-moz-animation: openLeft 2s ease-in-out forwards;
-ms-animation: openLeft 2 ease-in-out forwards;
animation: openLeft 2s ease-in-out forwards;
}
#-webkit-keyframes closeLeft {
from {
-webkit-transform: rotateY(0deg);
}
to {
-webkit-transform: rotateY(180deg);
}
}
#-moz-keyframes closeLeft {
from {
-moz-transform: rotateY(0deg);
}
to {
-moz-transform: rotateY(180deg);
}
}
#-ms-keyframes closeLeft {
from {
-ms-transform: rotateY(0deg);
}
to {
-ms-transform: rotateY(180deg);
}
}
#keyframes closeLeft {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(180deg);
}
}
#-moz-keyframes openLeft {
from {
-moz-transform: rotateY(180deg);
}
to {
-moz-transform: rotateY(0deg);
}
}
#-webkit-keyframes openLeft {
from {
-webkit-transform: rotateY(180deg);
}
to {
-webkit-transform: rotateY(0deg);
}
}
#-ms-keyframes openLeft {
from {
-ms-transform: rotateY(180deg);
}
to {
-ms-transform: rotateY(0deg);
}
}
#keyframes openLeft {
from {
transform: rotateY(180deg);
}
to {
transform: rotateY(0deg);
}
}
<div id="card">
<div class="heart" id="heart1"></div>
<div id="message">
<h2>Happy Valentines Day</h2>
</div>
<!-- <div class="heart" id="heart2"></div> -->
</div>
Here's the fiddle: https://jsfiddle.net/disinfor/y0p2t94q/1/
Edit for more info: the default origin for an element is 50% 50% 0 - which translates to the middle of the element. 0 0 moves the point of origin to the top left corner.
More reading: https://www.w3schools.com/cssref/css3_pr_transform-origin.asp
#rorschach: finally you got the animation, but did you notice your card area yet it's not sorted out!! when you hover on the card the animation should start I guess, so I think either you set max-width to the card.

How to move an element linearly while rotating with css

When i use transform on one element for translate3d and rotate3d then the element starts to orbit. i want linear motion while rotating.
i have used webkit animations in css
img{height:50px;
width:50px;
animation:tt;
animation-duration:10s;
position:relative;
top:40vh;
left:40vw;}
#keyframes tt
{ 0%{
transform:rotate3d(0,0,0,0) translate3d(0,0,0);
}
50%{
transform:rotate3d(0,0,1,2000deg) translate3d(300px,0,0);
}
}
i wanted it move forward while rotating like a cars tire instead its like a comet or excited electron
You could use the left and right CSS properties, similar example on https://www.w3schools.com/css/css3_animations.asp
I have included the snippet below:
https://codepen.io/mohamedhmansour/pen/bOONQr
img {
height: 50px;
width: 50px;
animation: tt;
animation-duration: 5s;
position: relative;
top: 0;
left: 0;
}
#keyframes tt {
0% {
transform: rotate(0deg);
left: 0px;
}
50% {
transform: rotate(-360deg);
left: 100%;
}
100% {
transform: rotate(0deg);
left: 0px;
}
}
<div class="wrapper">
<img src="http://blog.codepen.io/wp-content/uploads/2012/06/Button-Fill-Black-Small.png" />
</div>
https://codepen.io/mohamedhmansour/pen/bOONQr
You didn't define the 100% state so by default it will be the a transform:none (the default value since no transform is defined on the element) which is creating the issue. You should define it and use a bigger value for the angle by keeping the same axis to keep your element on the orbit:
.img {
height: 50px;
width: 50px;
animation: tt linear 10s;
position: relative;
top: 40vh;
left: 40vw;
background:red;
}
#keyframes tt {
0% {
transform: rotate3d(0, 0, 0, 0) translate3d(0, 0, 0);
}
50% {
transform: rotate3d(0, 0, 1, 2000deg) translate3d(100px, 0, 0);
}
100% {
transform: rotate3d(0, 0, 1, 4000deg) translate3d(100px, 0, 0);
}
<div class="img"></div>
And if you want a linear animation simply do like this (translation before rotation):
.img {
height: 50px;
width: 50px;
animation: tt linear 5s forwards;
position: relative;
top: 40vh;
left: 40vw;
background:red;
}
#keyframes tt {
0% {
transform: translateX(0) rotate(0);
}
100% {
transform: translateX(100px) rotate(360deg);
}
<div class="img"></div>
You can try this:
img{
height: 50px;
width: 50px;
position: absolute;
top:40vh;
left:40vw;
-webkit-animation: spinner 10s linear infinite;
left: 0;
}
#-webkit-keyframes spinner{
50%{
-webkit-transform: rotate(1440deg);
left: calc(100% - 200px);
}
}
<img src="https://www.gstatic.com/webp/gallery/4.sm.jpg">

CSS3 animation - two issues

Here are some issues which I can't seem to figure out.
When you hover on the image I am animating a few styles but as you will see, when the border size increases, everything else moves with it.
When you change the sidetext to something longer or shorter, it decides to move positions.
Please can someone explain what I am doing wrong?
/*
Colors:
#FF0F00 = red
#FFFF04 = yellow
#387F23 = green
*/
* {
box-sizing: border-box;
}
body {
margin: 0;
background-color: yellow;
font-family: Arial, Helvetica, sans-serif;
}
.animate {
animation-fill-mode: forwards;
animation-duration: 1s;
}
.one {
-webkit-animation-delay: 0.4s;
-moz-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.two {
-webkit-animation-delay: 1.7s;
-moz-animation-delay: 1.7s;
animation-delay: 1.7s;
}
.three {
-webkit-animation-delay: 2.3s;
-moz-animation-delay: 2.3s;
animation-delay: 2.3s;
}
.four {
-webkit-animation-delay: 3.3s;
-moz-animation-delay: 3.3s;
animation-delay: 3.3s;
}
#keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.fadeIn {
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
#keyframes fadeInDown {
from {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInDown {
-webkit-animation-name: fadeInDown;
animation-name: fadeInDown;
}
#keyframes fadeInLeft {
from {
opacity: 0;
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInLeft {
-webkit-animation-name: fadeInLeft;
animation-name: fadeInLeft;
}
/* FADE IN RIGHT */
#-webkit-keyframes fadeInRight {
from {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
#keyframes fadeInRight {
from {
opacity: 0;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
to {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
.fadeInRight {
-webkit-animation-name: fadeInRight;
animation-name: fadeInRight;
}
.container {
margin-left: auto;
margin-right: auto;
width: 100%;
}
.hero__img img {
max-width: 100%;
vertical-align: middle;
}
.hero__center:after {
position: absolute;
content: " ";
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: red;
/* z-index: -1; */
opacity: 0;
transition: opacity 0.4s ease-in;
}
#media (min-width: 920px) {
.hero {
margin: 0 auto;
width: 700px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
opacity: 0;
}
.hero__heading {
position: absolute;
font-size: 80px;
color: #0004f3;
text-transform: uppercase;
font-weight: bold;
font-kerning: -3px;
letter-spacing: 4px;
z-index: 1;
}
.hero__heading--top {
left: -85px;
top: -150px;
opacity: 1;
}
.hero__heading--bottom {
right: -85px;
bottom: -150px;
opacity: 1;
}
.hero__center {
position: relative;
border: 5px solid blue;
transition: border 0.4s ease-in;
}
.hero__center:hover {
border: 10px solid #387F23;
transition: border 0.4s ease-in;
}
.hero__center:hover:after {
opacity: 0.4;
transition: opacity 0.4s ease-in;
}
.hero__center:hover .hero__sideText {
color: red;
transition: color 0.4s ease-in;
}
.hero__img img {
opacity: 1;
transition: opacity 0.4s ease-in;
}
/* .hero__img:hover img {
opacity: 0.4;
transition: opacity 0.4s ease-in;
} */
/* .hero__center:hover {
border: 5px solid green;
transition: border 0.5s;
} */
.hero__sideText {
position: absolute;
top: 50%;
color: #0004f3;
transition: color 0.4s ease-in;
}
.hero__side--left {
left: -50px;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
transform-origin: center center;
}
.hero__side--right {
right: -50px;
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
transform-origin: center center;
}
}
<div class="container">
<div class="hero animate fadeIn one">
<div class="hero__center">
<span class="hero__heading hero__heading--top animate fadeInLeft one">Lorem</span>
<span class="hero__heading hero__heading--bottom animate fadeInRight one">Ipsum</span>
<div class="hero__img">
<img src="http://via.placeholder.com/980x550" alt="">
</div>
<span class="hero__sideText hero__side--left">Side text</span>
<span class="hero__sideText hero__side--right">Side text</span>
</div>
</div>
</div>
Since the size of your box changes by changing the border width, the elements change their position aswell.
try adding :
.hero__center:hover {
margin:-5px;
}
to work against the border change.
2.
The transform rotation uses the center point of your element as its origin (transform-origin: center center;). When increasing the characters you increase the width so the point which the rotation choses as its origin shifts aswell.
To change that you have to fix that point to a specific location. Try adding a div wrappers around your sideText spans with the following css:
.wrapper-left {
position:relative;
left: -50%;
}
.wrapper-right {
position:relative;
left: 50%;
}

CSS transform with parent transform does not work on iOS Safari

I created a mockup of the situation because I wasn't able to create a testable version so easily. But to get the gist:
#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 is enough to know where the issue is.
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..
Looks like you forgot -webkit- prefix. Also recommend using translate3d for hardware acceleration. Try this way:
#-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);
}