Blur background color css
Blurred background effects are a visually appealing way to enhance user interface design while maintaining readability of important content. This technique involves applying a blur filter to the background while keeping the foreground content clear and crisp. The use of this effect can significantly improve the aesthetic quality of a webpage, giving it a modern and elegant feel.
Demo:
Clear Content
This content is not blurred, but the background is!
Example Code Overview
/* Apply a background to the body for better visibility */ body.body-back { background: url('https://img.freepik.com/free-photo/fantasy-eye-illustration_23-2151675421.jpg') no-repeat center center fixed; background-size: cover; height: 100vh; display: flex; justify-content: center; align-items: center; margin: 0; } /* Container with blurred background */ .container { position: relative; width: 80%; max-width: 600px; padding: 20px; background: rgba(255, 255, 255, 0.6); /* Semi-transparent background */ backdrop-filter: blur(10px); /* Apply blur to the background */ border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } /* Content inside the container */ .container .content { position: relative; z-index: 1; color: black; /* Ensure content stands out */ text-align: center; }
<body class="body-back"> <div class="container"> <div class="content"> <h1>Clear Content <p>This content is not blurred, but the background is!</p> </div> </div> </body>
In the HTML and CSS example provided, we use a blurred background image with a semi-transparent container that displays text content clearly.
1- Background Image Setup: The background image is applied to the <body> element using CSS:
background: url('image-url') no-repeat center center fixed; background-size: cover;
- background-size: cover image will covers the entire background.
- The fixed positioning ensures the background remains static when scrolling.
2- Container with Blur Effect: The main focus is on the container that holds the content. The CSS backdrop-filter property applies the blur effect:
backdrop-filter: blur(10px);
- This blurs only the background behind the container, not the content inside it.
- The container also has a semi-transparent background using rgba(255, 255, 255, 0.6) to allow some visibility of the blurred background behind it.
3- Content Design: Inside the container, text and headings are styled to stand out against the blurred background. The z-index ensures the content stays in the foreground, while other styling options (e.g., padding, shadow) improve readability.
Use Cases for Blurred Backgrounds
User Interfaces (UIs) and Web Applications:
- Login or Registration Pages: Many modern websites use blurred background images behind login forms. It gives the page a sleek, polished look, while ensuring that the form fields remain highly readable.
- Modals and Popups: Blurred backgrounds can draw attention to a modal or popup dialog by blurring the rest of the page, creating a clear contrast between the foreground (important content) and the blurred background.
- Profile or User Dashboard Sections: Blurring the background of user dashboards or profile sections, especially when featuring complex data or reports, helps maintain focus on the core content.
Hero Sections and Landing Pages:
Many websites use a large, eye-catching image in the hero section (the main section that users see first). Adding a blur to the image creates a soft, less distracting background that helps the main message or call-to-action stand out more clearly.
Product Showcases:
Blurred backgrounds can be particularly effective when showcasing a product, as they keep the focus on the product while the background contributes to the overall design. For instance, in e-commerce websites, a subtle blur effect can highlight the product images or descriptions.
Content Overlays:
In cases where overlaying text or images is necessary, a blurred background provides a great solution for maintaining visibility while still utilizing a visually appealing backdrop. News websites or blogs can use this effect for banner text or important announcements that overlay background images.
Portfolios and Creative Websites:
Designers and creatives often showcase their work using bold, eye-catching designs. A blurred background can add a touch of sophistication without overwhelming the user’s attention, which should be focused on the content itself.
Advantages of Using Blurred Backgrounds
- Improves Visual Hierarchy: Blurring the background reduces distractions and keeps the user’s attention on the key content.
- Aesthetic Appeal: It provides a modern, clean look to the design, making the website or application feel polished and professional.
- Enhanced Readability: By reducing background noise, blurred backgrounds ensure text remains easy to read, especially when using busy or complex images.
Conclusion
The blurred background effect is a versatile and popular design technique that enhances user experience and brings a polished, modern look to web designs. Whether it’s for login forms, hero sections, or content overlays, this effect allows designers to combine background imagery with clear, readable content in a balanced and visually appealing way.
By using simple CSS properties like backdrop-filter and rgba for semi-transparency, developers can easily implement this effect across various components and layouts, making it a valuable tool in the design toolkit.