Performance: Backdrop blur (frosted glass)
Backdrop blur affects the paint and composite stages of rendering, impacting how quickly the browser can display the blurred background behind an element.
Jump into concepts and practice - no test required
<div class="backdrop-blur-sm bg-white/20 max-w-md mx-auto rounded-lg">Content</div><div class="backdrop-blur-lg bg-white/30">Content</div>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large backdrop blur on full screen overlay | Low | 0 | High (large area blurred) | [X] Bad |
| Small backdrop blur on limited container | Low | 0 | Low (small area blurred) | [OK] Good |
backdrop-blur do in a web page?backdrop-blur class applies a blur filter to the area behind the element, not the element itself.backdrop-blur specifically blurs the background behind the element.bg-transparent backdrop-blur allows the background behind the element to show blurred, creating the frosted glass effect.<div class='relative w-64 h-32 bg-cover bg-[url(https://example.com/bg.jpg)]'>
<div class='absolute inset-0 bg-white/30 backdrop-blur-md flex items-center justify-center text-black font-bold'>
Frosted Glass Effect
</div>
</div>backdrop-blur-md.backdrop-blur-md blurs the background behind the overlay, which is the image, creating a frosted glass look behind the text.backdrop-blur to a div but see no blur effect. What is the most likely reason?<div class='???'>Card Content</div>
bg-white/20 gives a white background with 20% opacity, allowing background to show blurred behind. backdrop-blur-lg applies a strong blur for clear frosted effect.rounded-lg for smooth corners, p-6 for padding, max-w-sm mx-auto centers and limits width for responsiveness.