Blurry Background Image Effect Using CSS
A blurry background image effect enhances website design, making text stand out while keeping the background visually appealing. This effect is achieved using CSS filters or the backdrop-filter
property.
Step 1: HTML Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Blurry Background Image</title> <meta name="description" content="Learn how to create a beautiful blurry background image effect using HTML and CSS. Step-by-step guide with code examples."> <meta name="keywords" content="blurry background CSS, CSS background blur, HTML CSS blur effect, blurred image background, CSS filter backdrop"> </head> <body> <!-- Blurry Background Image --> <div class="background"></div> <!-- Content Box with Blur Effect --> <div class="content"> <h1>Blurry Background Effect</h1> <p>This is an example of a blurry background image with a semi-transparent text box using CSS.</p> </div> </body> </html>
Step 2: CSS Code
* { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, sans-serif; } /* Background Image Styling */ .background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: url('https://via.placeholder.com/1500') no-repeat center center/cover; filter: blur(10px); /* Blurry effect */ } /* Content Box with Backdrop Filter */ .content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80%; max-width: 600px; padding: 20px; background: rgba(255, 255, 255, 0.3); backdrop-filter: blur(8px); text-align: center; border-radius: 10px; color: #fff; font-size: 18px; } /* Text Styling */ h1 { font-size: 30px; margin-bottom: 10px; } p { font-size: 16px; }