DEV Community

Robson Muniz
Robson Muniz

Posted on • Edited on

5 2

📜Awesome Page Scroll Effect | HTML & CSS✨

How to make Awesome Full Page Scroll Effect using html &css Using HTML & CSS, step-by-step from scratch.
Let’s create a nice scroll animation with just 4 lines of code!

Markup

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS SNAP EFFECT</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>

  <div class="container">

    <section class="one">
      <h1>First Page</h1>
    </section>

    <section class="two">
      <h1>Second Page</h1>
    </section>

    <section class="three">
      <h1>Third Page</h1>
    </section>

    <section class="four">
      <h1>Web Dev</h1>
    </section>
  </div>

</body>

</html>
Enter fullscreen mode Exit fullscreen mode

CSS

@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

.container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    height: 100vh;
}

section {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    scroll-snap-align: start;
}

h1 {
    color: rgb(226, 226, 226);
    text-shadow: 1px 1px 4px #000;
}

.one {
    background-color: rgb(36, 164, 138);
}
.two {
    background-color: rgb(211, 79, 79);
}
.three {
    background-color: rgb(67, 91, 175);
}
.four {
    background-color: rgb(191, 64, 191);
}
Enter fullscreen mode Exit fullscreen mode

🛴 Follow me on:
Facebook: https://bit.ly/3cp2S5W
YouTube: https://bit.ly/3oBQbc0
Twitter: https://bit.ly/3zejZ6f

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay