What are CSS Filters?
CSS filters apply graphical effects like blur, color shifting, and distortion to elements. They're non-destructive, performance-friendly, and work on images, backgrounds, text, and any HTML element without modifying source assets.
Basic Syntax
Complete Filter Functions
| Function | Description | Valid Values | Example |
|---|---|---|---|
| blur() | Gaussian blur | length (px, rem) | blur(4px) |
| brightness() | Adjust brightness | 0-∞ (1 = original) | brightness(0.5) |
| contrast() | Adjust contrast | 0-∞ (1 = original) | contrast(200%) |
| grayscale() | Converts to grayscale | 0-1 or 0%-100% | grayscale(1) |
| hue-rotate() | Rotate color hue | angle (deg, turn) | hue-rotate(90deg) |
| invert() | Invert colors | 0-1 or 0%-100% | invert(75%) |
| opacity() | Adjust transparency | 0-1 or 0%-100% | opacity(0.5) |
| saturate() | Color intensity | 0-∞ (1 = original) | saturate(2) |
| sepia() | Sepia tone effect | 0-1 or 0%-100% | sepia(0.8) |
| drop-shadow() | Shadow following shape | offset-x offset-y blur color | drop-shadow(5px 5px 10px #000) |
Practical Examples
Drop Shadow Deep Dive
Advanced Filter Combinations
backdrop-filter: Background Effects
Performance & GPU Acceleration
Browser Support & Fallbacks
Interactive Gallery Example
Best Practices
- Use filters for progressive enhancement – Always provide acceptable fallbacks
- Combine filters strategically – Order matters (applied left to right)
- Test performance – Heavy filters on large areas can cause jank
- Use will-change for animations – Optimizes rendering pipeline
- Prefer backdrop-filter for overlays – More performant than separate elements
- Avoid filter on text-heavy areas – Can cause readability issues
Common Mistakes
- Over-filtering – Too many effects look unprofessional
- Ignoring performance – Animating blur on large images
- Forgetting accessibility – Low contrast after filters
- Using filter on fixed elements – Can cause repaint performance issues
- Assuming browser support – Test on target browsers
Accessibility Considerations
Conclusion
CSS filters are powerful, non-destructive tools for creating rich visual effects entirely in the browser. From simple image adjustments to complex glassmorphism and vintage effects, filters enable creative UI without performance-heavy JavaScript or edited assets. Combine with transitions for interactive experiences, use backdrop-filter for modern overlays, and always consider accessibility and performance.