Parallax effect
by Saksham Malhotra
HTML
<div class="wrapper">
<div class="top"><span>Hello</span></div>
<div class="bottom"></div>
</div>
CSS
body {
margin: 0;
padding:0;
font-family: Arial;
}
.wrapper {
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
perspective: 2px;
}
.top,
.bottom {
height: 100vh;
}
.top {
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.top span {
font-size: 144px;
z-index: 1;
}
.top::after {
content: '';
/*background: linear-gradient(to bottom, yellow, green);*/
background-image: url('https://placekitten.com/g/900/700');
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: -5px;
transform: translateZ(-1px) scale(1.5);
background-size: cover;
z-index: -1;
}
.bottom {
background-color: black;
}