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
Key point:
CSS filters apply effects to the rendered element. 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:

filters.css All filter functions with syntax

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.

glassmorphism.css Frosted glass card effect

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.

Browser support:
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.

blend-modes.css Common blend modes

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.css Common clip-path shapes
Tip:
Use 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: Glassmorphism card

Create a frosted glass card with backdrop-filter and mix-blend-mode for text.

✏️ Try It Yourself β€” Glassmorphism
Preview
Challenge: Advanced Filter Effects

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: lighten for 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.
  • filter affects the element itself; backdrop-filter affects what's behind it (frosted glass effect).
  • Blend modes control color blending: mix-blend-mode for elements, background-blend-mode for backgrounds.
  • clip-path clips elements to shapes: circle(), polygon(), inset(), ellipse().
  • Combine filters, blend modes, and clip-path for modern, polished UI effects.

Test your knowledge

Question 1 of 5
Which filter makes an image completely grayscale?
Question 2 of 5
What does backdrop-filter do?
Question 3 of 5
What does clip-path do?
Question 4 of 5
What's the difference between filter and backdrop-filter?
Question 5 of 5
What does mix-blend-mode: multiply do?
0
/5
Excellent work! You've mastered CSS effects.
Africa & India's Best AI Academy
πŸ€– AI-first πŸŽ“ Placement Assistance

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 β†’