To start choose your image, I chose the image below
Then create the skeleton of your HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
</style>
<title>Your Title</title>
</head>
<body>
</body>
</html>
create a div which will contain the image of the background
<div class="header"></div>
and the other div (the mask) that will contain the text
<div class="text-mask">
<h1 style="font-size:60px">I am Schleidens</h1>
<p>And I'm a Web developer</p>
</div>
now let's go to our css to give style to our header and type this code
body, html {
height: 100%;
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
select our div with the class .header
and add the codes below
.header {
/* The image used */
background-image: url("image-name.extensions");
/* blur effect */
filter: blur(8px);
-webkit-filter: blur(8px);
/* Full height size*/
height: 100%;
/* Center and scale the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
after we select our mask with the class .text-mask
add the codes below
.text-mask {
background-color: rgb(0,0,0);
background-color: rgba(0,0,0, 0.4);
color: white;
font-weight: bold;
border: 3px solid #f1f1f1;
/* now center the mask*/
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
width: 80%;
padding: 20px;
text-align: center;
}
launch the file in your browser, you should have this result.
try to understand the friends <(o_o)>.
see you soon guys :)
Top comments (0)