Shadows and filters in CSS
Depth and image effects: box shadows, text shadows, filters, blend modes.
.card {
box-shadow:
0 1px 2px rgb(0 0 0 / 20%),
0 8px 24px rgb(0 0 0 / 25%);
}
.overlay {
backdrop-filter: blur(10px) saturate(120%);
}
.logo {
filter: drop-shadow(0 2px 4px rgb(0 0 0 / 40%));
}
.dim {
filter: grayscale(1) brightness(0.8);
}
How it works
- Layering two soft shadows reads more naturally than one hard one.
filter: bluraffects the element,backdrop-filterwhat is behind.drop-shadowfollows an alpha shape, unlikebox-shadow.
Keywords and builtins used here
blurbrightnesscarddimfiltergrayscalelogooverlaypxrgbsaturate
The run, in numbers
- Lines
- 17
- Characters to type
- 244
- Tokens
- 92
- Three-star pace
- 90 tpm
At the three-star pace of 90 tokens a minute, this run takes about 61 seconds.
Step 8 of 8 in Motion & effects, step 18 of 21 in Responsive & modern CSS.