Change Background Image on Scroll
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="STYLESHEET" type="text/css" href="web.css">
<title>web design</title>
</head>
<body>
<div class="imge img1"></div>
<div class="imge img2"></div>
<div class="imge img3"></div>
<div class="imge img4"></div>
<div class="imge img5"></div>
<div class="imge img6"></div>
<div class="text">TEXT</div>
</body>
</html>
CSS Change Background Image on Scroll Style
*{
box-sizing: border-box;
}
body{
height:100%;
margin:0;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
.imge{
height:50%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.img1{
background-image: url(snow.jpg);
}
.img2{
background-image: url(shit.jpg);
}
.img3{
background-image: url(lights.jpg);
}.img4{
background-image: url(hero.jpg);
}.img5{
background-image: url(forest.jpg);
}.img6{
background-image: url(woods.jpg);
}
.text{
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
color: white;
font-size:80%;
font-weight: bold;
border:10px solid #f1f1f1;
position: fixed;
top:50%;
left:50%;
transform: translate(-50%,-50%);
z-index:2 ;
width:300px;
padding:20px ;
text-align: center;
}
No comments:
Post a Comment