filter PropertyThe CSS filter property provides graphical effects like blurring, color shifting, and more, directly to images, backgrounds, and any HTML element. Filters are functions that modify the rendering of an element, and can be combined for creative effects. They are widely used for image manipulation, hover effects, and UI polish.
How Filters Work: Filters are applied after the element is rendered, meaning they affect the final pixels on the screen. This allows you to visually transform images, backgrounds, SVGs, and even text without changing the underlying content. Filters can be stacked in a single filter property, and the order of filters matters—each filter is applied in sequence to the result of the previous one.
Performance & Use Cases: CSS filters are hardware-accelerated in most modern browsers, making them efficient for UI effects and transitions. However, excessive or complex filters (especially on large images or many elements) can impact performance. Use filters for creative image effects, focus/blur transitions, color adjustments for accessibility, and dynamic UI feedback (e.g., dimming a button on hover).
Creative Tips: Try combining multiple filters for unique effects, such as grayscale() with blur() for a frosted glass look, or hue-rotate() with brightness() for vibrant color shifts. Filters can also be animated with CSS transitions for smooth, interactive experiences.
filter: function(value) function2(value2) ...;filter property.grayscale(), blur(), brightness(), contrast(), saturate(), hue-rotate(), invert(), opacity(), sepia().Filters can be animated and combined for advanced effects. They work on images, backgrounds, SVGs, and even text.
.grayscale-demo {
filter: grayscale(100%);
}
.blur-demo {
filter: blur(4px);
}
.brightness-demo {
filter: brightness(1.5);
}
.contrast-demo {
filter: contrast(200%);
}
.saturate-demo {
filter: saturate(300%);
}
.hue-rotate-demo {
filter: hue-rotate(120deg);
}
.invert-demo {
filter: invert(1);
}
.opacity-demo {
filter: opacity(0.5);
}
.sepia-demo {
filter: sepia(100%);
}
.combined-demo {
filter: grayscale(60%) blur(2px) brightness(1.2) contrast(120%) hue-rotate(60deg);
}