Performance: Shadow utilities
Shadow utilities affect the paint and composite stages of page rendering by adding visual depth with shadows.
<div class="shadow-sm"></div> <div class="shadow-sm"></div> <div class="shadow-sm"></div>
<div class="shadow-lg"></div> <div class="shadow-lg"></div> <div class="shadow-lg"></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large shadows on many elements | Low | 0 | High paint and composite cost | [X] Bad |
| Small shadows on few elements | Low | 0 | Low paint and composite cost | [OK] Good |
shadow-lg do to an element?shadow-lgshadow-lg class adds a large shadow, making the element appear raised and deeper.shadow-none to remove shadows from elements.shadow-none is a valid Bootstrap class to remove shadows.<div class="shadow-sm p-3 mb-5 bg-white rounded">Small Shadow Box</div>
shadow-sm is applied, which means a small shadow.shadow-none. What will happen?shadow-none removes any shadow from the element.<div class="?"> <header class="?">Card Header</header> <main>Card content</main> </div>
shadow-lg on the div to add a large shadow around the card.shadow-none on the header to ensure it has no shadow inside the card.Pass the test and this pattern moves unknown