3 ms·
1) For optimal performance, should contain: strict be applied for any type of elements? Or just for containers (div,span, ul, etc) Is e.g adding contain: strict
by The_rationalist 7y ago
1)
For optimal performance, should contain: strict be applied for any type of elements? Or just for containers (div,span, ul, etc)
Is e.g adding contain: strict or contain:content to <p> a noop bloat that is going to decrease performance? (because p never have descendants but would still enable a check by the browser and make the css bigger).
Also 2): if I understand correctly, if contain: content is applied to a parent divs, it will apply to all it's child divs.
So it would be a bloat and a noop to apply contain:content to it's child divs?
Therefore is the optimal selector: body > div {
contain: content;
}
or is it div {
contain: content;
Or is it * {} (and if so, with or without pseudo elements?)
Edit: regarding 2) it seems to be refuted as I've read that all elements by default are not and inherited to false, therefore contain on a parent does not set contain on it's children.
But 1) is still unknown and not answered anywhere which is a shame.