Gradients, Layered Shadows & Backdrop Filters
Add visual depth with linear/radial gradients, realistic multi-layered box-shadows, and frosted-glass backdrop-filter surfaces.
What you'll learn
- Create smooth linear and radial CSS gradients without image files
- Combine subtle ambient and direct box-shadows for realistic elevation
- Build frosted-glass sticky surfaces using backdrop-filter: blur()
Depth and surface separation guide the user’s eye. Modern CSS lets you craft crisp surfaces (gradients, soft elevation shadows, and frosted glass)with zero image assets.
Realistic Layered Shadows
A single harsh black shadow (0 4px 10px black) looks dated. Pair a tight low-opacity shadow with a soft diffused shadow:
.elevated {
box-shadow:
0 1px 2px rgb(15 23 42 / 0.06),
0 12px 24px -4px rgb(15 23 42 / 0.12);
}
Fill-in-the-Blank Exercise
Frosted Glass Surface
Create a diagonal gradient background and a frosted-glass blur overlay.
.banner {
background: (135deg, #2563eb, #7c3aed);
}
.glass {
background: rgb(255 255 255 / 0.8);
: blur(8px);
}Try It Yourself
Tweak the gradient angle, shadow softness, or backdrop-filter blur radius below:
Check Your Understanding
1. Which CSS property blurs the content *behind* a semi-transparent element?
Finished this lesson?
Your progress is saved locally in your browser, no account needed.