How to create: blurred background image
- Previous page Focus image
- Next page Change background on scroll
Learn how to create a blurred background image using CSS.
Blurred background image
Note:This example is not compatible with Edge 12, IE 11, or earlier versions.
How to create a blurred background image
Step 1 - Add HTML:
<div class="bg-image"></div> <div class="bg-text"> <h1>I am Bill Gates</h1> <p>And I'm a Photographer</p> </div>
Step 2 - Add CSS:
body, html { height: 100%; } * { box-sizing: border-box; } .bg-image { /* Image used */ background-image: url("photographer.jpg"); /* Add blur effect */ filter: blur(8px); -webkit-filter: blur(8px); /* Full height */ height: 100%; /* Center the image and scale appropriately */ background-position: center; background-repeat: no-repeat; background-size: cover; } /* Place text in the center of the page/image */ .bg-text { background-color: rgb(0,0,0); /* fallback color */ background-color: rgba(0,0,0, 0.4); /* black semi-transparent/see-through */ color: white; font-weight: bold; border: 3px solid #f1f1f1; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; width: 80%; padding: 20px; text-align: center; }
- Previous page Focus image
- Next page Change background on scroll