Pure CSS Parallax Effect

Parallax is an effect where background images are fixed and contents of the background moving.

Parallax Effect:

Parallax is an effect where background images are fixed and the contents of the background image are moving, In this article, we will create Pure CSS parallax effect. so now let's get started


Pure CSS Parallax Effect
Pure CSS Parallax Effect 

Requirement:


First of all, create an index.html file in your machine/System and copy the below code and paste the copied code in your index.html file

index.html




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Parallax Effect</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
  
    <section class="section-1">
        <div class="common">
            <h1>Parallax Effect</h1>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita similique, omnis repellendus labore quod mollitia aut a vel et voluptatem totam illo sunt dolores magni dolorum. Suscipit, quia? Placeat, distinctio.</p>
            <span class="count">1</span>
        </div>
    </section>

    <section class="section-2">
        <div class="common">
            <h1>About us</h1>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita similique, omnis repellendus labore quod mollitia aut a vel et voluptatem totam illo sunt dolores magni dolorum. Suscipit, quia? Placeat, distinctio.</p>
            <span class="count">2</span>
        </div>
    </section>

    <section class="section-3">
        <div class="common">
            <h1>Contact us</h1>
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita similique, omnis repellendus labore quod mollitia aut a vel et voluptatem totam illo sunt dolores magni dolorum. Suscipit, quia? Placeat, distinctio.</p>
            <span class="count">3</span>
        </div>
    </section>
    
</body>
</html>
Now create a style.css file and copy the below code and paste that code in your style.css file

style.css


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.section-1 {
    width: 100%;
    height: 100vh;
    background: url("1.jpg") no-repeat;
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0,0,0,.7);
    background-blend-mode: overlay;
}

.section-2 {
    width: 100%;
    height: 100vh;
    background: url("2.jpg") no-repeat;
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0,0,0,.7);
    background-blend-mode: overlay;
}

.section-3 {
    width: 100%;
    height: 100vh;
    background: url("3.jpg") no-repeat;
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0,0,0,.7);
    background-blend-mode: overlay;
}

.common {
    color: #fff;
    width: 50%;
}

.common h1 {
    font-size: 50px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.common h1::first-letter {
    font-size: 80px;
    color: orange;
    font-weight: bold;
}

.count {
    display: block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    background: #fff;
    color: #333;
    margin: 12px 0;
    font-size: 20px;
    font-weight: bold;
}

COMMENTS

Name

ajax,2,HTML & CSS,19,JavaScript,1,PHP,11,
ltr
item
webtipstricks: Pure CSS Parallax Effect
Pure CSS Parallax Effect
Parallax is an effect where background images are fixed and contents of the background moving.
https://i.ytimg.com/vi/Xpx8nVahSWo/hqdefault.jpg
https://i.ytimg.com/vi/Xpx8nVahSWo/default.jpg
webtipstricks
https://www.webtipstricks.com/2019/01/pure-css-parallax-effect.html
https://www.webtipstricks.com/
https://www.webtipstricks.com/
https://www.webtipstricks.com/2019/01/pure-css-parallax-effect.html
true
4027471107773963481
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy