Squeezing peak rendering performance out of a browser increasingly depends on giving it hints about the content it is about to handle. Responsive image markup is one example: the sizes attribute declares how wide the image will render, while w descriptors state the intrinsic widths of the candidates. More familiar image elements have long accepted width and height presentational attributes, which are useful once again. CSS offers the will-change property for animation hinting, and anything involving offline capability or deeper performance work generally means writing custom service worker code.

What contain adds to the picture

The CSS contain property joins this list. Its job is to describe your layout to the browser so the browser can process it faster. The property is optional rather than required — an enhancement you can layer on top of an existing design for optimization.

.item {
  contain: layout;
  contain: paint;
  contain: size;

  contain: content; /* same as `layout paint` */
  contain: strict;  /* same as `layout paint size` */
}

The layout value, in plain terms

Rachel Andrew's explanation of layout containment gets at what the browser gains:

With layout containment enabled, the browser knows that nothing outside the element can affect the internal layout, and nothing from inside the element can change anything about the layout of things outside it. This means that it can make any possible optimizations for this scenario.

That isolation is not free of side effects. Layout containment triggers a z-index context, clears floats and hides overflow, so applying it is squarely in the "know what you are doing" category.

Where it fits: component libraries

Design systems are a natural home for the property, because components are usually built to be self-contained. Andrew's guidance:

I would suggest that this is a great thing to add to any components you create in a component or pattern library, if you are working in this way it is likely each component is designed to be an independent thing that does not affect other elements on the page, making contain: content a useful addition.