Junior JavaScript

What is CSS containment?

contain tells the browser which aspects of an element’s rendering are independent

from the rest of the document — reducing reflows and repaints.

Example:

.card {

Follow me on LinkedIn:

contain: layout paint;

Key Takeaway:

Containment isolates elements for performance optimization.

More from JavaScript Tutorial

All questions for this course