Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS animation "transform: scale" not working in Safari and possibly other browsers

Tags:

css

safari

@-webkit-keyframes scaleIn {
    from {-webkit-transform: scale(0);}
    to {-webkit-transform: scale(1);}
}

.animate-log-in {
  animation-name: scaleIn;
  animation-duration: 0.5s;
}

It's working on the latest version of Chrome (Mac OSX) but not in the latest version of Safari and an older version (I think) of Chrome. Is there anything I need to add?

like image 861
frosty Avatar asked Jun 11 '15 04:06

frosty


People also ask

Do CSS animations work on all browsers?

CSS animations do not work with all browsers. Therefore, when using a browser with CSS animation, you need to take note of the browser version and test to see whether the elements you are using are supported.

Does Safari support CSS animation?

Safari supports two types of CSS animation: transition animations and keyframe animations.

Why is my CSS animation not working?

Animation Duration Not Set By default, a CSS animation cycle is zero seconds long. To override this, add an animation-duration rule to your targeted element with a seconds value, in the same block as animation-name. Below, try removing the comments around animation-duration to fix the animation.

Which browsers would support the Webkit animation parameter?

Browser Compatability This property is a proprietary extension that is only supported in Chrome and Safari browsers.


1 Answers

I noticed another Safari issue when animating scale.

Seems Safari doesn't respects your scale if the element has display: inline (e.g. is a span). Make it block or inline-block.

This isn't animation-specific. It also goes for changing the scale with no animation.

This was with Safari 9. Also with the Mobile Safari of iOS 9.

Chrome does not have this issue. It will happily change the scale of an inline element.

JSFiddle to see it in action: https://jsfiddle.net/ca64gkma/5/

like image 104
Henrik N Avatar answered Oct 08 '22 04:10

Henrik N