Properties That Trigger Repaint
You'll learn which CSS properties cause the browser to repaint elements without triggering layout recalculation, and understand their performance implications.
What Is a Repaint?
When you learned about the rendering pipeline, you saw that some property changes don't affect an element's size or position—they only change its appearance. When this happens, the browser skips the layout step but still needs to repaint the pixels on screen. This is faster than a full reflow, but still requires work.
Properties That Trigger Repaint Only
These properties change how something looks without moving or resizing anything:
color- text color changesbackground-color- background fillsbackground-image- background graphicsborder-color- border appearance (not size)border-style- solid, dashed, dotted, etc.box-shadow- shadows around elementsoutline- outlines (which don't affect layout)visibility- showing/hiding without layout impact
Think of it like repainting a wall: you're not moving any furniture (layout) or even changing how light hits the room (compositing)—you're just applying new paint.
Performance Impact
Repaints are less expensive than reflows because the browser doesn't need to recalculate positions and sizes. However, they still require the browser to redraw potentially large portions of the screen, which takes time on the CPU.
For smooth animations, you learned that properties triggering reflow are slowest. Repaint-only properties are moderate performers—better than reflow, but not as optimal as compositor-only properties (like transform and opacity, which you've already studied).
Key Takeaway: Repaint-triggering properties change appearance without affecting layout, making them faster than reflow properties but still requiring visual updates that can impact performance during animations or frequent changes.