How to make the Blur Background

Ritik Tiwari
1 min readApr 12, 2023

--

Here is the code for making your blur background, you can use these stuffs in your projects and showcase in the portfolio.

HTML CODE

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blur Background</title>
</head>
<body>
<div class="bg-image"></div>
<div class="bg-text">
<h1>I am Ritik Tiwari</h1>
<p>Full Stack Developer</p>
</div>
</body>
</html>

CSS CODE

body, html {
height: 100%;
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}

* {
box-sizing: border-box;
}

.bg-image {
filter: blur(8px);
-webkit-filter: blur(8px);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-image: url("https://p.bigstockphoto.com/GeFvQkBbSLaMdpKXF1Zv_bigstock-Aerial-View-Of-Blue-Lakes-And--227291596.jpg");
}

.bg-text {
background-color: rgba(0, 0, 0, 0.4);
color: #fff;
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;
}

OUTPUT

Meet you in next story, signing off.

theritiktiwari 💙

--

--