
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
How to create a "parallax" scrolling effect with CSS?
To create a parallax scrolling effect with CSS, the code is as follows −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; height: 100vh; margin: 0px; padding: 0px; } .parallax { background-image: url("https://i.picsum.photos/id/250/800/800.jpg"); height: 100%; background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; } .parallaxText { font-size: 20px; height: 100%; } </style> </head> <body> <div class="parallax"></div> <div class="parallaxText"> <h1>Some random text</h1> <h1>Some random text</h1> <p> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Facere, praesentium assumenda illum nisi minima libero accusamus adipisci aspernatur architecto qui aliquam quo similique eos vitae. Cum iste laboriosam vero excepturi eum sed ex fuga repellat accusantium officia rerum ducimus sequi maiores reprehenderit veniam corrupti, aspernatur explicabo nesciunt architecto voluptate! Consectetur. </p> </div> <div class="parallax"></div> </body> </html>
Output
The above code will produce the following output −
On scrolling down a little the parallax effect can be seen as shown −
- Related Articles
- How to Create a Parallax Scrolling Effect in CSS
- How to create a smooth scrolling effect with CSS?
- How to Create a Parallax Effect using HTML, CSS, and JavaScript?
- Creating a parallax scrolling effect in React using react-spring.mp4
- How to create a transition effect with CSS?
- How to create fading effect with CSS
- How to create an overlay effect with CSS?
- How to create image overlay hover effect with CSS?
- How to create a wave ball effect using CSS?
- Smooth Scrolling with Pure CSS
- How to create image overlay icon effect on hover with CSS?
- Create a transition effect on hover pagination with CSS
- How to create Text Split effect using CSS?
- How to create Candle Animation effect using CSS?
- How to create an image overlay zoom effect on hover with CSS?

Advertisements