πŸ’‘ This page contain affiliate links. By making a purchase through them, we may earn a commission at no extra cost to you.
How to Blur Background Behind Elements in CSS

How to Blur Background Behind Elements in CSS

Ferenc Almasi β€’ 2020 November 30 β€’ Read time 1 min read
  • twitter
  • facebook
CSS

You can use the backdrop-filter property in CSS to blur the background image behind an element with a transparent background:

Copied to clipboard! Playground
.background {
    background-image: url(castle.jpg)
}

.backdrop {
    backdrop-filter: blur(1);
}
backdrop.css

It applies to everything behind the element where the backdrop-filter is defined, therefore make sure you make the element at least partially transparent in order to see the result. This property is often used to blur out the background behind a popup.

Also, this not only works with blur, but with other filter functions as well.

Copied to clipboard! Playground
.backdrop {
    backdrop-filter: brightness(50%);
    backdrop-filter: contrast(50%);
    backdrop-filter: drop-shadow(0 0 5px #000);
    backdrop-filter: grayscale(100%);
    backdrop-filter: hue-rotate(90deg);
    backdrop-filter: invert(100%);
    backdrop-filter: opacity(50%);
    backdrop-filter: sepia(100%);
    backdrop-filter: saturate(100%);
}
backdrop.css
How to blur backgrounds in CSS
If you would like to see more Webtips, follow @flowforfrank

10 Best Practices for Quickly Improving Your CSS

Resources:

  • twitter
  • facebook
CSS
Did you find this page helpful?
πŸ“š More Webtips
Mentoring

Rocket Launch Your Career

Speed up your learning progress with our mentorship program. Join as a mentee to unlock the full potential of Webtips and get a personalized learning experience by experts to master the following frontend technologies:

Courses

Recommended

This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.