liveBook · Manning

Chapter 17: Animations

What you will learn in chapter 17 of CSS in Depth, Second Edition

Introduces keyframe animations as a way to create motion with more defined points than a transition, while noting that animation can provide useful feedback.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces keyframe animations as a way to create motion with more defined points than a transition, while noting that animation can provide useful feedback.

Key terms: transition, keyframe animation, keyframe, interpolates, frames, meaningful feedback, animation

17.1 Keyframes

This section shows how to define and apply a CSS keyframe animation, then explains its timing, repetition, and precedence over ordinary styles.

Key terms: @keyframes, keyframe, background-color, transform, animation, animation-name, animation-duration, animation-timing-function, animation-iteration-count, iteration

17.2 Animating 3D transforms

This section previews building a card layout on the existing page before adding animation.

17.2.1 Building the layout without animations

Build the cards’ responsive layout and styling before adding their 3D fly-in animation.

Key terms: flyin-grid, card, module, mobile-first, normal block elements, media query, grid columns, repeat(), auto-fit, breakpoints

17.2.2 Adding animation to the layout

This section adds a 3D fly-in animation to a card layout using shared perspective and staged keyframes.

Key terms: keyframes, translateZ(), rotateY(), opacity, perspective, flyin-grid container, flyin-grid item

17.3 Animation delay and fill mode

This section shows how to stagger grid-item animations with delays and use fill mode to prevent delayed items from appearing before they animate.

Key terms: animation-delay, stagger, animation-fill-mode, none, backwards, forwards, both, first frame

17.4 Conveying meaning through animation

This section explains that animation can serve a practical purpose by conveying meaning as part of the user experience.

Key terms: animation, integrated into the experience, convey specific meaning

17.4.1 Responding to user interaction

This section builds a Save-button loading spinner that reassures users while a form waits for a server response.

Key terms: visual indication, loading spinner, preventDefault(), is-loading, disabled, pseudo-element, border radius, color: transparent, negative margins, infinite

17.4.2 Drawing the user’s attention

The section shows how a shaking Save button can unobtrusively remind users to save, and how CSS and JavaScript make the reminder play when typing pauses.

Key terms: shake, Save button, keyframes, translate, shake class, keyup, timeout, animationend

17.5 Scroll-based timelines

This section explains how CSS can tie an animation’s progress to scrolling, how to choose the scroll source and direction, and why browser support limits its use.

Key terms: animation-timeline, scroll(), scroll-driven animation, scroll(nearest), scroll(root), scroll(self), block, inline, x, Firefox

17.6 One final piece of advice

The section encourages readers to keep developing their CSS skills through curiosity, experimentation, and learning from others.

Key terms: DevTools, CSS features

17.7 Summary

Concepts explained in this chapter

← Chapter 16: Transforms

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.