CSS filter Property Explained
What the CSS filter property does, with an example.
Published November 6, 2026
filter applies visual effects to an element: blur, brightness, contrast, grayscale, sepia, hue-rotate, saturate, invert, opacity and drop-shadow.
How it works
Multiple functions chain left to right. Filters apply to the element and its children and can be animated.
drop-shadow follows the alpha shape, unlike box-shadow.
Values and effects
filter: blur(4px); → soften
filter: grayscale(100%); → black and white
filter: brightness(1.2); → lighter
filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); → shape shadow
Practical examples
Dim on disabled
.disabled { filter: grayscale(1) opacity(.6); }Hover brighten
img { transition: filter .2s; }
img:hover { filter: brightness(1.1); }Shadow on a PNG icon
.icon { filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }Common mistakes
- Heavy blurs on large elements hurting performance.
- Expecting filter to only affect the background.
- Creating a new stacking context unexpectedly.
Key takeaways
- filter in one line: filter applies visual effects to an element: blur, brightness, contrast, grayscale, sepia, hue-rotate, saturate, invert, opacity and drop-shadow.
- Inspect it live in DevTools → Styles.
- Test across browsers and screen sizes.
FAQ
filter vs backdrop-filter?
filter affects the element itself; backdrop-filter affects what is behind it.
Is filter supported in all browsers?
Yes in all modern browsers; check caniuse.com for edge cases.