Filter Property

suggest change

Syntax

Parameters

Value | Description |
—— | —— |

Function Description
blur(x) Blurs the image by x pixels.
brightness(x) Values above 1 or 100% brighten the image. Lower values darken it. 1 leaves it unchanged.
contrast(x) Values above 1 or 100% increase contrast. Lower values decrease contrast. This is not the same as saturation.
drop-shadow(x y blur color) Draws a drop shadow that follows the alpha outline. Offsets may be negative. Blur and color are optional. There is no spread parameter; that exists on box-shadow, not drop-shadow().
grayscale(x) Converts the image toward gray. 1 or 100% is fully gray. The spelling is grayscale, not greyscale.
hue-rotate(x) Rotates the hue by the given angle.
invert(x) Inverts the colors. 1 or 100% is a full inversion.
opacity(x) Sets the opacity of the filtered rendering. 1 or 100% is fully opaque.
saturate(x) Values above 1 or 100% increase saturation. Lower values decrease it.
sepia(x) Converts the image toward sepia. 1 or 100% is fully sepia.

Remarks

  1. Write the standard unprefixed filter property. A -webkit- prefix is only a legacy fallback, not the current spelling.
  2. Prefer box-shadow when you need a rectangular shadow, including spread. Use filter: drop-shadow() when the shadow should follow a transparent image’s outline. Prefer the opacity property when you only need to fade an element, because filter: opacity() also creates a containing group.
  3. In the CSSOM, set element.style.filter. WebkitFilter is the legacy prefixed alias.
  4. See MDN for the full function list.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents