Home > Article > Web Front-end > How to Achieve a CSS Glass Blur Effect on 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.
The above is the detailed content of How to Achieve a CSS Glass Blur Effect on an Overlay?. For more information, please follow other related articles on the PHP Chinese website!