Junior From PDF JavaScript JavaScript

What is reflow and repaint in CSS?

They are part of the browser’s rendering process when the DOM or styles change.

  • Reflow (Layout): Happens when the structure or geometry of the page changes (like

changing size, position, or adding elements).

→ Expensive operation since it recalculates layout.

Follow me on LinkedIn:

  • Repaint: Happens when visual appearance (like color or background) changes

without affecting layout.

Example:

div.style.width = "200px"; /* triggers reflow + repaint */
div.style.background = "red"; /* triggers repaint only */

Key Takeaway:

Minimize layout changes; batch DOM updates to improve performance.

More from JavaScript Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details