Article Thumbnail

Add background blur with one line of CSS

Axorax
1 min readJul 28, 2024

Adding background blur to an element can make it more visually appealing and it’s also REALLY use to do it. So, you might as well add it cuz why not? ¯\_(ツ)_/¯

The line of code you need

backdrop-filter: blur(5px);

Besides that, make sure that the element that will have a blurred background is not a solid color but is a bit transparent. And, ensure that the background of that element is not a solid color either.

Full code / Example

HTML

<h1>Subscribe to Axorax!</h1>

CSS

body {
background: url("./nature.jpg") no-repeat center center / cover;
display: flex;
justify-content: center;
align-items: center;
height: 100dvh;
font-family: "arial", sans-serif;
}

h1 {
padding: 1.5rem;
border-radius: 10px;
color: #ffffff;
/* ↓ Important ↓ */
background: rgba(255, 255, 255, 0.06);
backdrop-filter: blur(5px);
}
Preview Image

Thanks for reading! Have an amazing day! ✨

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Axorax
Axorax

Written by Axorax

0 Followers

Hey! I like coding and tech

No responses yet

Write a response