effectsintermediate

CSS Filter

Visual effects applied to an element's rendering, including blur, brightness, contrast, and grayscale.

Plain English

CSS filters are like Instagram filters for UI elements — they let you blur, brighten, dim, or desaturate things without editing the original assets. The most common UI use case: blur(20px) for frosted glass effects (a translucent header blurring the content beneath it). Brightness and grayscale are useful for showing disabled or inactive states on images. The filter property is applied on top of the rendered element.

Technical

The filter CSS property accepts: blur(px), brightness(%), contrast(%), grayscale(%), hue-rotate(deg), invert(%), opacity(%), saturate(%), sepia(%), and drop-shadow(). backdrop-filter applies the same effects to everything behind the element (frosted glass), not the element itself. Key performance note: filter and backdrop-filter trigger GPU compositing — use will-change: filter or transform: translateZ(0) on animated filters. backdrop-filter requires a non-transparent background to be visible.

Live Demo

UI Card

none

Default

UI Card

blur(2px)

Background layers

UI Card

grayscale(100%)

Disabled / inactive

UI Card

brightness(0.6)

Overlay backdrop

CSS filters let you create disabled, blurred, and darkened states without new assets.

Usage

✓ Good usage

Apply backdrop-filter: blur(12px) + background: rgba(255,255,255,0.85) to a sticky header so it appears frosted, maintaining context as users scroll.

✗ Bad usage

Applying filter: blur(4px) to text to show "coming soon" content — blurred text is unreadable and inaccessible.

Common mistakes

AI Prompt Example

Copy this into Claude, Cursor, Bolt, or v0.

Apply backdrop-filter: blur(12px) + saturate(180%) with a semi-transparent white background to the sticky header for a frosted glass effect. Use filter: grayscale(1) opacity(0.5) on disabled thumbnail images.