Before you start to experiment in moving elements with CSS it’s useful to know what can’t be animated. In the current spec, the following properties cannot be manipulated with keyframes or transitions:
- scrolling of the entire body; that is the realm of JavaScript
- gradients (Gradient animation is part of the specification, but not supported in any browser yet, with the surprising exception of IE10+)
- almost anything to do with the background property, including
background-image
, althoughbackground-position
can be animated. - you cannot animate the
height
of an element from an auto-computed, natural height (e.g. an element filled with text), although is is possible to animate itsmin-height
While there are usually ways around these limitations, including animating SVG gradients – it’s good to know what CSS can’t do before you waste a lot of time and energy.
Resources
- A list of what the CSS spec currently can animate.
- Can I Animate, a searchable index of animatable properties.
Photograph by Pablo Fernández, licensed under Creative Commons
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.