DEV Community

Shrihari Mohan
Shrihari Mohan

Posted on • Updated on

Navbar with background blur! Aesthetic look in 2 lines of code .

The one thing I always do when I begin a project is to add a navbar with background blur. Just got obsessed with it.

My Personal Website. View
Personal Website

PvZ2PlantsVsZombies

Open source Contibution.


We will see how to do this in your website too! Just add this to your navbar container.

.bg-blur {
  background: transparent;
  backdrop-filter: blur(10px);
}
Enter fullscreen mode Exit fullscreen mode

Code Review

background: transparent; - If you are having background color make sure you remove color and add this. This is what allows the background content to be visible on the navbar.

backdrop-filter: blur(10px); - This creates that smooth transition of navbar over background with that blur. Play with that values. 10px works good for me.

For more information. MDN Docs

Browser Compatability

Peace 🕊


If you are here it means you may have enjoyed reading this blog. Just follow me @shrihari which will motivate to write more, contribute open source.

You can make a drink Buttermilk 🥛. Small support comes a long way!

Subscribe If you want to receive these blogs in your mail from @Medium for free!

Try Our new product for free!

DocsAI - Create AI support agents with your documents in the most affordable price, starts at 0$. Don't need a bot , but need ai help on your docs just upload and start chating !

Using for a company ? Check out our pricing Just contact me for personalized pricing !

docsAi

Top comments (6)

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I used to make this effect by taking a screenshot of the page with html-to-canvas then setting that as the background of the navbar, making it skroll with the page then use js stack blur.. then filter came and I swapped to CSS partially, I waited years for this to drop it, came in to force a couple of years back... I'm old

Collapse
 
shrihari profile image
Shrihari Mohan

Haha , yes sir ! You re old .. but uh html-canvas seems like a bit much.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

100% it was a bit much, why I never used the effect in production, but the fact that I could way way before it was available that made me feel smart 🤓👍☕

Thread Thread
 
shrihari profile image
Shrihari Mohan

We can do anything to make us feel smart. It's never bit much.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

I think it's true you should flex, I made the mistake in my early career of mixing that flex with my actual job, simplicity is the way to productive work with achievable estimates

Collapse
 
stefino76 profile image
Stefano Baccetti

Awesome!🤩