CSS Filter Property
The filter property in CSS is a powerful tool used to apply graphical effects like blurring or color shifting to an element. It is commonly used on images, backgrounds, and borders.
Common Filter Functions
The property accepts several functions:
blur(): Applies a Gaussian blur to the input image.grayscale(): Converts the input image to grayscale.brightness(): Applies a linear multiplier to the input image.contrast(): Adjusts the contrast of the input.drop-shadow(): Applies a drop shadow effect to the input image.
Combining Filters
You can apply multiple filters at once by separating them with spaces. For example: filter: grayscale(100%) blur(5px);. The order matters, as filters are applied sequentially.
Performance Note
While powerful, filters can be computationally expensive, especially on large images or when animating them. Use them judiciously to maintain smooth performance.
