0
0
Bootsrapmarkup~8 mins

Shadow utilities in Bootsrap - Performance & Optimization

Choose your learning style9 modes available
Performance: Shadow utilities
MEDIUM IMPACT
Shadow utilities affect the paint and composite stages of page rendering by adding visual depth with shadows.
Adding shadows to multiple elements for visual depth
Bootsrap
<div class="shadow-sm"></div>
<div class="shadow-sm"></div>
<div class="shadow-sm"></div>
Using smaller shadows reduces paint complexity and GPU load, improving rendering speed.
📈 Performance Gainreduces paint and composite cost per element, improving frame rate
Adding shadows to multiple elements for visual depth
Bootsrap
<div class="shadow-lg"></div>
<div class="shadow-lg"></div>
<div class="shadow-lg"></div>
Applying large shadows to many elements triggers multiple paint and composite operations, increasing rendering cost.
📉 Performance Costtriggers multiple paint and composite layers, increasing GPU workload
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
Large shadows on many elementsLow0High paint and composite cost[X] Bad
Small shadows on few elementsLow0Low paint and composite cost[OK] Good
Rendering Pipeline
Shadow utilities add visual effects that require the browser to calculate styles, paint shadows, and composite layers, impacting rendering performance.
Style Calculation
Paint
Composite
⚠️ BottleneckPaint and Composite stages are most expensive due to shadow rendering.
Core Web Vital Affected
LCP
Shadow utilities affect the paint and composite stages of page rendering by adding visual depth with shadows.
Optimization Tips
1Limit the number of elements with shadows to reduce paint cost.
2Prefer smaller shadows to minimize GPU workload.
3Avoid animating shadows to prevent frame drops.
Performance Quiz - 3 Questions
Test your performance knowledge
Which Core Web Vital is most affected by heavy use of shadow utilities?
ALargest Contentful Paint (LCP)
BInteraction to Next Paint (INP)
CCumulative Layout Shift (CLS)
DFirst Input Delay (FID)
DevTools: Performance
How to check: Record a performance profile while interacting with the page. Look for long paint or composite events related to shadow styles.
What to look for: High paint or composite times indicate expensive shadow rendering affecting frame rate.