This properties is used to apply the various effects to the elements for differentiate or make them match to the theme.
It applies a Gaussian blur effect to an element.
Syntax: filter: blur(radius);
Example:
.blurred-image {
filter: blur(5px);
}
It adjusts the brightness of an element.
Syntax: filter: brightness(percentage);
Example:
.brighter-image {
filter: brightness(120%);
}
It adjusts the contrast of an element.
Syntax: filter: contrast(percentage);
Example:
.higher-contrast-image {
filter: contrast(150%);
}
It converts an element to grayscale.
Syntax: filter: grayscale(percentage);
Example:
.grayscale-image {
filter: grayscale(100%);
}
It rotates the hue of an element.
Syntax: filter: hue-rotate(angle);
Example:
.hue-rotated-image {
filter: hue-rotate(90deg);
}
It inverts the colors of an element
Syntax: filter: invert(percentage);
Example:
.inverted-image {
filter: invert(100%);
}
It sets the opacity of an element.
Syntax: filter: opacity(percentage);
Example:
.transparent-element {
filter: opacity(50%);
}
It applies a sepia tone to an element.
Syntax: filter: sepia(percentage);
Example:
.sepia-image {
filter: sepia(100%);
}
It apply the multiple filters to an element. By using the filter property separated by spaces.
Example:
.filtered-image {
filter: blur(5px) brightness(120%) contrast(150%);
}