DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Programmatic Brand Extraction: Pulling Logos, Colors, and Assets from Any URL
  • Querying Without a Query Language
  • The Death of the CSS Selector: Architecting Resilient, AI-Powered Web Scrapers
  • A Guide to Parallax and Scroll-Based Animations

Trending

  • Introducing RAI Audit Kit: Evidence-Grade Responsible AI Audits in Python
  • Your AI Is Not Failing, Your Context Is
  • Getting Started With GitHub Copilot CLI for Coding Tasks
  • If You Can Survive a Toddler, You Can Ship LLMs in Production
  1. DZone
  2. Coding
  3. Languages
  4. iOS Crystalline Blurred Backgrounds with CSS Backdrop Filters

iOS Crystalline Blurred Backgrounds with CSS Backdrop Filters

In this tutorial, let's look at how to make a blurred crystalline effect with one of CSS's newest properties.

By 
Johnny Simpson user avatar
Johnny Simpson
·
Nov. 10, 21 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
7.7K Views

Join the DZone community and get the full member experience.

Join For Free

iOS is full of cool crystalline glass effects. This effect has long been easy to do when you have easy access to graphic shaders since these can do most of the heavy lifting in terms of calculating what is underneath the layer, and blurring it into the foreground. However, for a long time, it hasn't been possible in CSS... until now.

In more recent specifications of CSS, we have finally gotten backdrop-filter. Mostly meant for modals, it also has applications on stylized dropdowns which are common across the web.

In this tutorial, we'll be looking at how to make a tinted blurred glass effect with just modern CSS.

How It Works 

To highlight exactly what this looks like, I've put together a demo of the functionality. Note: as shown in the support tables at the bottom, Firefox won't display these correctly - so better to check out in a Webkit or Blink-based browser like Chome or Safari.

Each of these uses pure CSS, but you can see the background image blur through to the dropdown, creating a pretty cool crystalline, see-through, blurred effect.

To understand a bit more about how this works, I've copied the code below. The CSS property on the notification style to check out is backdrop-filter - this applies a filter to the background layer. We can use any filter here, but here we use blur(33px) to blur the transparent background color.

CSS

CSS
 
.effect-holder {
    height: auto;
    width: calc(33.3% - 1rem);
    border-radius: 16px;
    float: left;
    background-size: 100%;
    background-repeat: no-repeat;
    background-image: url(image.png);
}
.dropdown-style {
    margin: 0 1rem 0 0;
    background-color: #ffffff7d;   
    margin: 2rem;
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    box-shadow: 0 10px 15px rgb(0 0 0 / 20%);
    box-sizing: border-box;
    width: calc(100% - 4rem);
    color: rgba(0,0,0,0.8);
    backdrop-filter: blur(33px);
    background-blend-mode: overlay;
    display: flex;
    align-items: center;
}

.dropdown-style > img {
    width: 32px;
    margin: 0 1rem 0 0;
}


HTML

HTML
 
<div class="effects">
    <div class="effect-holder">
        <div class="dropdown-style">
            <img src="" alt="">
            <span>Some Message</span>
        </div>
    </div>
    <div class="effect-holder dark">
        <div class="dropdown-style black">
            <img src="" alt="">
            <span>Some Message</span>
        </div>
    </div>
    <div class="effect-holder">
        <div class="dropdown-style black">
            <img src="" alt="">
            <span>Some Message</span>
        </div>
    </div>
</div>


Other Filters and Mix Modes

Since we can use backdrop-filter works in the same way as filter, and we also have access to mix-blend-mode, we can do some other cool effects. Here's an example with see-through text by using a lighten blend mode:

CSS
 
.el {
    mix-blend-mode: lighten;
    backdrop-filter: blur(33px);
}


The Notification Center

It wasn't really enough for me to try out using this to make a simple notification-style demo. So I tried something a little bit bigger and made the Mac OS notification center using this effect. It doesn't exactly mimic what they have there, but it is a cool example of how this effect could be deployed in more complicated frontend user experiences.

Support

As with all new features, backdrop-filter doesn't have complete support. However, it does have enough support to warrant its use in projects today. The only major browser without support is Firefox, which can be enabled in the Firefox flags for experimentation.

Conclusion

This new CSS property is pretty neat, and it degrades gracefully in browsers that don't support it. I hope you've enjoyed this short look into it. If you want to see the source code for the final demo, check it out via the Codepen link here.

CSS Filter (software)

Published at DZone with permission of Johnny Simpson. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Programmatic Brand Extraction: Pulling Logos, Colors, and Assets from Any URL
  • Querying Without a Query Language
  • The Death of the CSS Selector: Architecting Resilient, AI-Powered Web Scrapers
  • A Guide to Parallax and Scroll-Based Animations

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook