Course contentsShow
← Web Development
Lesson 541 of 2,9829. CSS Transitions and AnimationsFree lesson

Properties That Trigger Reflow

Learn which CSS properties force layout recalculation and how to avoid them.

Properties That Trigger Reflow

You'll learn which CSS properties force expensive layout recalculations and how to identify them for better animation performance.

What Is a Reflow?

Remember the browser's rendering pipeline you just learned? A reflow (also called layout recalculation) happens when the browser must recalculate the size and position of elements on the page. Think of it like rearranging furniture in a room—every time you move the couch, you might need to shift the coffee table, rug, and chairs too. This domino effect is computationally expensive.

Properties That Trigger Reflow

When you animate or transition certain CSS properties, you force the browser to do this costly recalculation:

Geometry properties:

  • width, height
  • margin, padding, border (and all logical equivalents like margin-inline-start)
  • top, right, bottom, left, inset

Text and content properties:

  • font-size, line-height
  • text-align

Display properties:

  • display

Every time these change, the browser must:

  1. Recalculate layout (reflow)
  2. Repaint pixels
  3. Composite layers

This happens every frame during an animation—potentially 60 times per second!

The Better Alternative

As you learned in transform best practices, properties like transform and opacity skip the reflow step entirely. They only affect compositing, making animations silky smooth.

Instead of animating left, use transform: translateX(). Instead of animating width, consider transform: scaleX() if appropriate.

Key Takeaway: Avoid animating properties that change layout (width, height, margins, positions) because they trigger expensive reflows—stick to transform and opacity for smooth, performant animations.