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,heightmargin,padding,border(and all logical equivalents likemargin-inline-start)top,right,bottom,left,inset
Text and content properties:
font-size,line-heighttext-align
Display properties:
display
Every time these change, the browser must:
- Recalculate layout (reflow)
- Repaint pixels
- 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.