CSS Fade In on Scroll

Items fade and slide up as they scroll into view, with animation-timeline: view() instead of a scroll library.

  • scroll-driven
  • reveal
  • view timeline
  • fade up
  • animate on scroll
  • aos
HTML
<ul class="scroll-reveal">
  <li>Plan</li>
  <li>Design</li>
  <li>Build</li>
  <li>Launch</li>
</ul>
CSS
.scroll-reveal {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: system-ui, sans-serif;
}

.scroll-reveal li {
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px -10px rgba(20, 83, 45, 0.35);
  color: #14532d;
  font-size: 18px;
  font-weight: 700;
}

@supports (animation-timeline: view()) {
  .scroll-reveal li {
    animation: scroll-reveal-in linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
  }
}

@keyframes scroll-reveal-in {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal li {
    animation: none;
  }
}

About this CSS Fade In on Scroll

This CSS Fade In on Scroll is 44 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses scroll-driven animations, keyframe animations, transforms and box shadows. It relies on scroll-driven animations, which not every browser supports yet, so check the browser notes below. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #fff
  • #14532d

How to use this fade in on scroll

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .scroll-reveal class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback