Animating CSS

CSS is a powerful tool, and one of the powers it has is that many CSS properties can be animated. You can animate the color, position, and even the shape of a CSS element. This gives you the ability to make your site more dynamic and interesting by just adding and removing CSS classes.

Three somewhat overlapping CSS concepts allow you to animate the display of existing elements with CSS:

  • transform is a CSS property that instantly changes the values of other CSS properties by changing the size, position, or orientation of the element being drawn.

  • transition specifies a CSS property and a duration. When the specified property changes, the change happens gradually over the specified duration of time, rather than instantaneously. ...

Get Modern Front-End Development for Rails, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.