CSS Filter
Written By: Avinash Malhotra
Updated on:
CSS Filter Property
CSS Filter property is used to add filter effects to images or elements. This includes properties like url, blur, contrast, grayscale, hue-rotate and drop-shadow. Filter effects can be used on images, backgrounds or borders to add effects.
Filter Functions
Change Filter for image
blur
blur function is used to add blur to images or backgrounds. Default value is 0px. Blur value is in px. For example, to change blur 10px, use filter:blur(10px)
in css.
Change blur of image
contrast
contrast function is used to add contrast to images or backgrounds. Default value is 1. Contrast value can be 0 to any positive number. For example, to change contrast 0, use filter:contrast(0)
in css.
Change contrast of image
grayscale
grayscale function is used to add contrast to images or backgrounds. Default value is 0. grayscale value can be 0 to 1. For example, for full grayscale image, use filter:grayscale(1)
in css.
Change contrast of image
hue-rotate
hue-rotate function is used to change hue rotation to images or backgrounds. Default value is 0. filter:hue-rotate(180deg)
in css.
Change hue-rotate of image
drop-shadow
drop-shadow function is used to add shadows to images. Default value is 0. For example, use filter:drop-shadow(0 0 10px)
in css.