"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Achieve a CSS Glass Blur Effect on an Overlay?

How to Achieve a CSS Glass Blur Effect on an Overlay?

Posted on 2025-03-05
Browse:197

How to Achieve a CSS Glass Blur Effect on an Overlay?

Applying CSS Glass/Blur Effect to an Overlay

Q: Implementing a blur effect on a semi-transparent overlay

A web developer is facing difficulties in applying a blur effect to an overlay div, making the content behind the div appear blurred.

Previous Attempt:

The developer attempted to implement the effect using the following CSS:

#overlay {
    filter:blur(4px);
    -o-filter:blur(4px);
    -ms-filter:blur(4px);
    -moz-filter:blur(4px);
    -webkit-filter:blur(4px);
}

However, this approach was unsuccessful.

Revised Solution:

For a simpler and more modern solution, the developer can utilize the backdrop-filter property:

#overlay {
    backdrop-filter: blur(6px);
}

Browser Support:

Note that browser support for backdrop-filter is not comprehensive. However, for many use cases, a blur effect is not critical.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3