
Containment in CSS isolates a DOM subtree from the rest of the document tree, improving performance by limiting layout, style, and paint calculations. It has four types: size, layout, style, and paint, which can be set on the container to scope CSS counters and quotes.