How to create Amazing Parallax Scrolling | HTML & CSS Project - Frontend everything
Hello Everyone 👋 Welcome to My New Blog. Today I have made an Amazing Parallax Scrolling with the help of HTML and CSS Only! 😍
I am Piyush, Sharing About Web development Daily. You can also check out me at @frontendeverything.
Before starting the blog, you might think about where you can use this project in real-life-based projects. So it's an Amazing Parallax Scrolling that you can use in your own blog project. So it will look attractive.
Let's start making these amazing Parallax Scrolling Using HTML & CSS step by step.
Video of the project,
So that was the preview now let us start making the project 😄 First, we will code HTML then CSS, and also I have shared codepen ink to make it easier for you.
HTML 🎈( step - 1)
In HTML we have used divs for container. and used unsplash api for images
<div class="container">
<section class="image" style="background-image: url(https://images.unsplash.com/photo-1504357121897-47698286288d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=29c6dcd6a6f6c6a76c101e4336ae7c2d&auto=format&fit=crop&w=2851&q=80)"></section>
<section class="heading">
<h1>So green!</h1>
</section>
<section class="text" style="--bg: #c8c8bc">
<h1>Armenian highlands</h1>
</section>
<section class="image" style="background-image: url(https://images.unsplash.com/photo-1538964173425-93884d739596?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=e2f0390d79969aaf31e155bd1f7138b0&auto=format&fit=crop&w=1275&q=80)"></section>
<section class="heading">
<h1>Hot! hot! hot!</h1>
</section>
<section class="text" style="--bg: #638a87">
<h1>Paradise on earth</h1>
</section>
<section class="image" style="background-image: url(https://images.unsplash.com/photo-1531306728370-e2ebd9d7bb99?ixlib=rb-0.3.5&s=2950e56dc2bba8a65b82f130aa4e47ea&auto=format&fit=crop&w=900&q=60)"></section>
<section class="heading">
<h1>In a galaxy...</h1>
</section>
After the HTML we will design the container and give it a parallax effect..
Output till now
CSS🎈( step - 2)
/* Default use:
@include min-(width,4,240);
use width calculation
@include min-(width,4,240,'calc(100% - 240px)');
*/
html,
body {
background-color: black;
font-family: sans-serif;
}
.container {
height: 100vh;
overflow: hidden;
overflow-y: auto;
perspective: 3px;
}
section {
background-size: cover;
color: white;
background-color: var(--bg, --color-black);
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
section.image {
background-position: center center;
transform: translateZ(-1px) scale(1.5);
/* Force the background image to fill the whole element. */
background-size: cover;
/* Keep the image from overlapping sibling elements. */
z-index: -1;
height: 100vh;
}
section.text {
height: 50vh;
}
section.heading {
z-index: -1;
transform: translateY(-30vh) translateZ(1px) scale(1.5);
}
.footer {
position: relative;
display: block;
background-color: black;
height: 100vh;
color: white;
display: flex;
align-items: center;
justify-content: center;
}
.footer h3 {
font-weight: normal;
color: var(--color-blue);
}
Now we have done the CSS coding as well, now we will see the final output and also check the codepen link mentioned below.
Final Output
The codepen link is here for making your work easier!
.
If you found any value in this blog you can support me by buying me a coffee.
.
.
.
project:
.
.
Thank You For Scrolling Till here 😊. If You gain any knowledge then do checkout me at @frontendeverything. I am Piyush 🎉 I provide Content related to programming, technology, web development Daily.
.