CSS Filter

The CSS filter property allows you to apply visual effects such as blurring, brightness, contrast, and more to an element. It can be used to enhance the appearance of images, text, and other elements without the need for graphic manipulation in a photo editor.

Key Points on CSS Filter:

Syntax for CSS Filter Property:

Syntax Example

/* Example of filter property syntax */
                filter: function(value);
                
                /* Example of multiple filters */
                filter: blur(5px) brightness(1.2) grayscale(50%);

Examples of CSS Filter Functions:

The following examples demonstrate the usage of different filter functions:

Code Example: Blur


                    img {
                    filter: blur(5px);
                        }

Output

Blurred Image

Code Example: Brightness


                    img {
                    filter: brightness(1.5);
                        }

Output

Bright Image

Code Example: Grayscale


                    img {
                    filter: grayscale(100%);
                        }

Output

Grayscale Image

Common CSS Filter Functions:

The filter property allows for dynamic styling and interaction, especially when combined with hover or active states. By using filters creatively, you can create visually rich and engaging web designs without relying on external images or editing tools.