HTML & CSS · Senior · Question 7 of 75
What does contain: layout paint (or contain: content) give you?
- ✓Correct answer: A promise that contents don't affect outside layout and paint, narrowing recalculation
- 2It forbids the element from changing size after its first paint
- 3It only clips the content like
overflow: hidden, but without a scrollbar
Explanation
CSS Containment isolates a subtree: changes inside don't force layout and paint of the rest of the page. Useful for widgets, feeds and complex components. Side effect: paint clips content to the bounds and creates a containing block and a stacking context, so don't apply it thoughtlessly.