You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2026-04-02-what-is-css-containment-and-how-can-i-use-it.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -354,8 +354,8 @@ scopes a layout event to the whole document, touching 4,371 nodes and applying
354
354
new layout to just 41 of them—fewer than 10%:
355
355
356
356
<figure>
357
-
<imgsrc="/wp-content/uploads/2026/04/opentable-before.png"alt="Chrome DevTools performance profile showing OpenTable’s mobile drawer before containment. Opening the language switcher triggers a layout rooted at the whole document, touching 4,371 nodes and laying out 41 of them in 11.21 milliseconds."width="1500"height="966"loading="lazy">
358
-
<figcaption>11.21ms of layout work, rooted at <code>#document</code>, touching 4,371 nodes to relayout just 41. <ahref="/wp-content/uploads/2026/04/opentable-before-full.png">View full size/quality (1MB)</a></figcaption>
357
+
<imgsrc="{{ site.cloudinary }}/wp-content/uploads/2026/04/opentable-before.png"alt="Chrome DevTools performance profile showing OpenTable’s mobile drawer before containment. Opening the language switcher triggers a layout rooted at the whole document, touching 4,371 nodes and laying out 41 of them in 11.21 milliseconds."width="1500"height="966"loading="lazy">
358
+
<figcaption>11.21ms of layout work, rooted at <code>#document</code>, touching 4,371 nodes to relayout just 41. <ahref="{{ site.cloudinary }}/wp-content/uploads/2026/04/opentable-before-full.png">View full size/quality (1MB)</a></figcaption>
359
359
</figure>
360
360
361
361
While the whole operation only took 11 milliseconds, that’s still a lot of
@@ -365,8 +365,8 @@ By applying `contain: strict` to the drawer menu’s root DOM node, we can limit
365
365
the reach of the work and create incredible savings:
366
366
367
367
<figure>
368
-
<imgsrc="/wp-content/uploads/2026/04/opentable-after.png"alt="Chrome DevTools performance profile showing OpenTable’s mobile drawer after applying contain: strict. The layout root is now the drawer itself, touching 73 nodes and laying out 40 of them in 1.89 milliseconds."width="1500"height="966"loading="lazy">
369
-
<figcaption>1.89ms of layout work, rooted at the drawer itself, touching 73 nodes to relayout 40. <ahref="/wp-content/uploads/2026/04/opentable-after-full.png">View full size/quality (1MB)</a></figcaption>
368
+
<imgsrc="{{ site.cloudinary }}/wp-content/uploads/2026/04/opentable-after.png"alt="Chrome DevTools performance profile showing OpenTable’s mobile drawer after applying contain: strict. The layout root is now the drawer itself, touching 73 nodes and laying out 40 of them in 1.89 milliseconds."width="1500"height="966"loading="lazy">
369
+
<figcaption>1.89ms of layout work, rooted at the drawer itself, touching 73 nodes to relayout 40. <ahref="{{ site.cloudinary }}/wp-content/uploads/2026/04/opentable-after-full.png">View full size/quality (1MB)</a></figcaption>
370
370
</figure>
371
371
372
372
Now, we can see as clear as day that the operation only touched 73 DOM nodes, 40
0 commit comments