What are CSS filters?
CSS filters let you apply real-time visual effects to HTML elements without editing the source image. Think of them like Instagram filters but for the web β blur, grayscale, brightness, sepia, and more.
Unlike image editing, filters are applied with a single CSS property and can be animated, respond to hover, or change with JavaScript. This makes them perfect for:
- Image hover effects (grayscale on load, color on hover)
- Glassmorphism designs (frosted glass effect with
backdrop-filter) - Photo galleries with real-time adjustments
- UI polish like shadows, contrast, and brightness adjustments
filter affects the element itself, while backdrop-filter affects what's behind the element.
Filter functions reference
Here are all the filter functions available in CSS:
Try hovering over the gallery below to see filters in action:
Backdrop-filter: Glassmorphism
The backdrop-filter property applies effects to the area behind an element, creating the popular "frosted glass" or glassmorphism effect. This is a key design trend in modern UI.
Here's a live example of a glassmorphism card:
Premium Membership
Join Ramayai AI Academy and unlock full access to all courses, projects, and placement assistance.
backdrop-filter is well-supported in modern browsers (Chrome, Firefox, Safari, Edge). For older browsers, provide a fallback solid color.
Blend modes: mix-blend-mode & background-blend-mode
Blend modes control how colors combine when elements overlap. They're powerful for creating visual depth and mood.
Clip-path: Clipping elements to shapes
The clip-path property clips an element to a shape. You can create circles, polygons, and complex shapes without extra markup.
clip-path for visual effects and shapes. For SVG masking with more control, use the mask property with SVG or gradient masks.
Try it yourself: Filter gallery
Build an interactive filter gallery. Hover over images to toggle between filtered and original versions.
Try it yourself: Glassmorphism card
Create a frosted glass card with backdrop-filter and mix-blend-mode for text.
Task: Create a complete portfolio card with:
- A hexagonal profile picture using
clip-path: polygon() - A grayscaleβcolor filter on hover for the image
- A glassmorphism card overlay with
backdrop-filter: blur() - Text with
mix-blend-mode: lightenfor readability over the image - A drop-shadow on the hexagon for depth
Start with the glassmorphism editor above and add these elements. Use CSS only β no JavaScript needed for the effects!
Hint: Create a container with a background image. Place a div with clip-path: polygon(...) for the hexagon. Add the glass card on top. Use filter: grayscale(100%) on the image by default, remove it on parent hover. For text readability, try mix-blend-mode: lighten or color.
Key takeaways
- CSS filters apply visual effects: blur, grayscale, sepia, brightness, contrast, hue-rotate, saturate, invert, drop-shadow, opacity.
filteraffects the element itself;backdrop-filteraffects what's behind it (frosted glass effect).- Blend modes control color blending:
mix-blend-modefor elements,background-blend-modefor backgrounds. clip-pathclips elements to shapes:circle(),polygon(),inset(),ellipse().- Combine filters, blend modes, and clip-path for modern, polished UI effects.
Test your knowledge
You've mastered CSS effects.
Now build the future.
Join the Best AI Programs β three 5-month courses, fully online, with placement assistance. Week 1 is free.
Explore our AI-era courses β