Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a blurry background image with CSS?
Following is the code to create a blurry background image with CSS −
Example
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body,
html {
height: 100vh;
margin: 0;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
* {
box-sizing: border-box;
}
.backgroundImage {
background-image: url("https://images.pexels.com/photos/1172207/pexels-photo-1172207.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500");
filter: blur(10px);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.transparentText {
background-color: rgba(0, 0, 0, 0.4);
color: white;
border: 3px solid #f1f1f1;
position: absolute;
top: 40%;
left: 30%;
width: 50%;
padding: 20px;
text-align: center;
}
</style>
</head>
<body>
<div class="backgroundImage"></div>
<div class="transparentText">
<h1>I am Shawn</h1>
<h1>I am a web developer</h1>
</div>
</body>
</html>
Output
The above code will produce the following output −

Advertisements