Account
Categories
Shobha
Shobha
The best way to predict the future is to invent it

How do you implement parallax scrolling using CSS?

Parallax scrolling can be achieved by using background-attachment: fixed along with background positioning and size. This ensures the background remains stationary while the foreground elements move, producing a layered depth effect. For example:

.parallax {
background-image: url('image.jpg');
background-attachment: fixed;
background-position: center;
background-size: cover;
height: 100vh;
}