# filter

> The `filter` CSS property applies visual effects like blurring or color shifting to an element's rendering.

## How do I blur or grayscale an element with CSS filter?

The property that applies graphical effects like blur, brightness, contrast or drop shadow to an element. It allows modifying the appearance of images, backgrounds and text, adding visual effects without needing to edit the original content.

- Topic: Image Handling
- Type: property
- Browser support: Chrome 53+, Chrome Android 53+, Edge 12+, Firefox 35+, Firefox Android 35+, Safari 9.1+, Safari iOS 9.3+

## Example

Wrong:

```css
.glass {
  filter: blur(10px);
  background: rgb(255 255 255 / 0.5);
}
```

Right:

```css
.glass {
  backdrop-filter: blur(10px);
  background: rgb(255 255 255 / 0.5);
}
```

`filter` blurs the element and its text; `backdrop-filter` blurs only what is behind it.

## Common mistakes

- `filter: blur()` blurs the text of the element too, not just the background.
- A `position: fixed` child stops sticking to the viewport after a parent gets `filter`.

## Key points

- Shadows that follow transparent PNG or SVG shapes use `filter: drop-shadow()`, not `box-shadow`.
- Background blur behind glass panels uses `backdrop-filter`, not `filter`.
- Large animated `blur()` values are avoided on big areas, because they are expensive to paint.

## Interview questions

### Why does filter break position: fixed?

Any `filter` other than 'none' makes the element a containing block for fixed and absolute descendants, so they position against it.

### Can I combine several filter functions?

Yes. List them separated by spaces, like `filter: grayscale(1) contrast(2)`; they apply in order.

## Related cards

- [backdrop-filter](https://wonderium.dev/css/backdrop-filter.md)
- [drop-shadow()](https://wonderium.dev/css/drop-shadow.md)
- [blur()](https://wonderium.dev/css/blur.md)
- [grayscale()](https://wonderium.dev/css/grayscale.md)
- [Stacking Context](https://wonderium.dev/css/stacking-context.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/filter
- Last updated: 2026-11-25
