Performance: Full-bleed section within container
This affects the page's layout stability and paint performance by controlling how wide sections stretch beyond their containers.
<div class="container mx-auto relative"> <div class="absolute left-0 right-0 -mx-4 sm:-mx-6 bg-blue-500">Full-bleed content</div> </div>
<div class="container mx-auto"> <div class="w-screen bg-blue-500">Full-bleed content</div> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using w-screen inside container | Normal | Multiple reflows on resize | High paint cost due to overflow | [X] Bad |
| Using absolute positioning with negative margins | Normal | Single reflow | Lower paint cost, no overflow | [OK] Good |
absolute with left-0 right-0 inside a relative container stretches the element full width.relative or static do not remove container width limits; fixed positions relative to viewport but not container.<div class="container relative mx-auto p-4"> <section class="absolute left-0 right-0 bg-blue-500 h-20">Full-bleed</section> <div>Normal content</div> </div>
relative with padding and max width. The section is absolute left-0 right-0, so it stretches full width of container's relative box edges.relative. Inside it, add an absolute left-0 right-0 div with background color to stretch full width.Pass the test and this pattern moves unknown