Back to Gallery c01

CSS Scroll Reveal

FREE

Pure CSS scroll-triggered entrance animations. No JavaScript required. Uses native CSS scroll-driven animations for fade, slide, and scale effects.

cssscroll-revealcss-animationentrance-animation beginner

About This Effect

A pure CSS scroll animation system that uses native scroll-driven animations and the view() timeline — no JavaScript required. Elements fade, slide, scale, and rotate into view as they enter the viewport, with configurable animation ranges and timing functions. This lightweight approach leverages the browser's built-in compositor for optimal performance and zero JavaScript overhead.

What's Included

  • Pure CSS implementation — zero JavaScript dependency
  • Native scroll-driven animations using view() timeline
  • Multiple animation styles: fade, slide, scale, rotate, and combinations
  • Configurable animation ranges with CSS custom properties
  • Hardware-accelerated transforms via browser compositor
  • Automatic viewport detection without Intersection Observer
  • Stagger support through animation-delay offsets
  • Progressive enhancement — content visible without animation support

Perfect For

  • Performance-critical landing pages and marketing sites
  • Static sites and blogs that avoid JavaScript
  • Section reveals on content-heavy editorial pages
  • Lightweight scroll animations for mobile-first designs
  • Progressive enhancement layers on existing websites

How It Works

CSS scroll-driven animations bind an element's animation timeline to its visibility within the viewport using the view() function. As the element scrolls into view, the animation progresses from 0% to 100%. Custom properties control the entry and exit ranges, allowing precise control over when animations start and complete. All transforms run on the GPU compositor thread for jank-free rendering.

Difficulty Beginner
Includes HTML + JS + CSS source, documentation, lifetime updates
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="robots" content="noindex, nofollow">
		<title>CSS Scroll Reveal Demo | GSAP Vault</title>
		<link rel="stylesheet" href="assets/style.css">
		<link rel="preconnect" href="https://fonts.googleapis.com">
		<link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
	</head>
	<body>
		<!-- Hero fills viewport to demonstrate scroll animations -->
		<section class="hero" data-thumbnail-target>
			<div class="hero-content">
				<span class="page-badge">CSS Only</span>
				<h2 class="hero-title">CSS Scroll Reveal</h2>
				<p class="hero-subtitle">Native scroll-triggered animations. No JavaScript required.</p>
				<div class="scroll-hint">
					<span>Scroll to see animations</span>
					<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
						<path d="M12 5v14M5 12l7 7 7-7"/>
					</svg>
				</div>
			</div>
		</section>

		<main class="container">
			<!-- Browser Support Notice -->
			<div class="browser-notice">
				<div class="browser-notice-icon">
					<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
						<circle cx="12" cy="12" r="10"/>
						<path d="M12 16v-4"/>
						<path d="M12 8h.01"/>
					</svg>
				</div>
				<div class="browser-notice-content">
					<strong>Pure CSS Demo:</strong> This page uses native CSS scroll-driven animations. No JavaScript is used for the animation logic.
					<a href="https://caniuse.com/css-scroll-driven-animations" target="_blank" rel="noopener">Check browser support</a>
				</div>
			</div>

			<!-- Example 1: Fade In -->
			<section class="example">
				<div class="example-header">
					<span class="example-number">01</span>
					<h2 class="example-title">Fade In</h2>
				</div>
				<div class="example-content">
					<p class="example-instruction">Elements fade from transparent to opaque as they enter the viewport:</p>
					<div class="demo-area">
						<div class="demo-grid">
							<div class="card reveal-fade">
								<div class="card-icon">
									<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true">
										<circle cx="12" cy="12" r="10"/>
										<path d="M12 6v6l4 2"/>
									</svg>
								</div>
								<h3>Fast</h3>
								<p>Optimized for performance</p>
							</div>
							<div class="card reveal-fade">
								<div class="card-icon">
									<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true">
										<path d="M12 2L2 7l10 5 10-5-10-5z"/>
										<path d="M2 17l10 5 10-5"/>
										<path d="M2 12l10 5 10-5"/>
									</svg>
								</div>
								<h3>Simple</h3>
								<p>No JavaScript needed</p>
							</div>
							<div class="card reveal-fade">
								<div class="card-icon">
									<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true">
										<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
										<polyline points="22 4 12 14.01 9 11.01"/>
									</svg>
								</div>
								<h3>Native</h3>
								<p>Built into the browser</p>
							</div>
						</div>
					</div>
				</div>
			</section>

			<!-- Example 2: Slide Up -->
			<section class="example">
				<div class="example-header">
					<span class="example-number">02</span>
					<h2 class="example-title">Slide Up</h2>
				</div>
				<div class="example-content">
					<p class="example-instruction">Elements fade in while sliding up from below:</p>
					<div class="demo-area">
						<div class="demo-grid">
							<div class="card reveal-slide-up">
								<span class="card-number">01</span>
								<h3>Research</h3>
								<p>Understand the problem space</p>
							</div>
							<div class="card reveal-slide-up">
								<span class="card-number">02</span>
								<h3>Design</h3>
								<p>Create the solution</p>
							</div>
							<div class="card reveal-slide-up">
								<span class="card-number">03</span>
								<h3>Build</h3>
								<p>Implement with care</p>
							</div>
						</div>
					</div>
				</div>
			</section>

			<!-- Example 3: Scale In -->
			<section class="example">
				<div class="example-header">
					<span class="example-number">03</span>
					<h2 class="example-title">Scale In</h2>
				</div>
				<div class="example-content">
					<p class="example-instruction">Elements grow from smaller to full size:</p>
					<div class="demo-area">
						<div class="demo-grid demo-grid--2col">
							<div class="card card--large reveal-scale">
								<div class="card-image" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
									<span class="card-label">Featured</span>
								</div>
								<div class="card-body">
									<h3>Scale Animation</h3>
									<p>Grows smoothly into view</p>
								</div>
							</div>
							<div class="card card--large reveal-scale">
								<div class="card-image" style="background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);">
									<span class="card-label">Popular</span>
								</div>
								<div class="card-body">
									<h3>Subtle Effect</h3>
									<p>Adds depth without distraction</p>
								</div>
							</div>
						</div>
					</div>
				</div>
			</section>

			<!-- Example 4: Slide from Sides -->
			<section class="example">
				<div class="example-header">
					<span class="example-number">04</span>
					<h2 class="example-title">Slide From Sides</h2>
				</div>
				<div class="example-content">
					<p class="example-instruction">Elements slide in from left or right:</p>
					<div class="demo-area">
						<div class="demo-split">
							<div class="card reveal-slide-left">
								<h3>From Left</h3>
								<p>Slides in from the left side</p>
							</div>
							<div class="card reveal-slide-right">
								<h3>From Right</h3>
								<p>Slides in from the right side</p>
							</div>
						</div>
					</div>
				</div>
			</section>

			<!-- Limitations Section -->
			<section class="example example--info">
				<div class="example-header">
					<span class="example-number">
						<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
							<path d="M12 2L2 7l10 5 10-5-10-5z"/>
							<path d="M2 17l10 5 10-5"/>
							<path d="M2 12l10 5 10-5"/>
						</svg>
					</span>
					<h2 class="example-title">When to Use This</h2>
				</div>
				<div class="example-content">
					<div class="info-grid">
						<div class="info-card info-card--positive">
							<h3>CSS Scroll Animations Work Great For</h3>
							<ul>
								<li>Simple entrance animations (fade, slide, scale)</li>
								<li>Projects targeting modern browsers only</li>
								<li>When you need zero JavaScript</li>
								<li>Quick prototypes and MVPs</li>
								<li>Performance-critical lightweight pages</li>
							</ul>
						</div>
						<div class="info-card info-card--neutral">
							<h3>GSAP ScrollTrigger Advantages</h3>
							<ul>
								<li><strong>Full Browser Support</strong> - Works everywhere, not just modern browsers</li>
								<li><strong>Scrubbing & Pinning</strong> - Easily pin elements or scrub animations</li>
								<li><strong>Complexity</strong> - Handle complex sequencing and staggered timelines</li>
								<li><strong>Callbacks</strong> - Trigger JS functions at specific scroll points</li>
								<li><strong>Lenis/Smooth Scroll</strong> - Perfect integration with smooth scrolling</li>
							</ul>
						</div>
					</div>
				</div>
			</section>
		</main>

		<!-- Minimal JS for browser support detection only -->
		<script src="assets/script.js"></script>
	</body>
</html>
/**
 * CSS Scroll Reveal
 *
 * This effect is pure CSS - no JavaScript required for the animations.
 * This file only handles browser support detection for better UX.
 */

/**
 * CSS Scroll Reveal
 *
 * This effect is pure CSS - no JavaScript required for the animations.
 * This file only handles browser support detection for the UI notice.
 */

document.addEventListener('DOMContentLoaded', function() {
	'use strict';

	// Check for CSS scroll-driven animation support
	var supportsScrollTimeline = CSS.supports('animation-timeline', 'view()');

	if (!supportsScrollTimeline) {
		// Add class to body for potential styling hooks
		document.body.classList.add('no-scroll-timeline');

		// Update the browser notice
		var notice = document.querySelector('.browser-notice');
		if (notice) {
			notice.style.background = 'rgba(255, 100, 100, 0.08)';
			notice.style.borderColor = '#ff6464';
			notice.querySelector('.browser-notice-content').innerHTML = '<strong>Browser Not Supported:</strong> Your browser does not support native CSS scroll-driven animations yet. Elements will be visible but static.';
		}
	}
});
document.addEventListener("DOMContentLoaded",function(){"use strict";if(!CSS.supports("animation-timeline","view()")){document.body.classList.add("no-scroll-timeline");var e=document.querySelector(".browser-notice");e&&(e.style.background="rgba(255, 100, 100, 0.08)",e.style.borderColor="#ff6464",e.querySelector(".browser-notice-content").innerHTML="<strong>Browser Not Supported:</strong> Your browser does not support native CSS scroll-driven animations yet. Elements will be visible but static.")}});
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

:root {
	--bg: #050505;
	--surface: #0f0f0f;
	--card: #141414;
	--text: #f0f0f0;
	--text-muted: #888;
	--accent: #c8ff00;
	--accent-dim: rgba(200, 255, 0, 0.1);
	--border: rgba(255, 255, 255, 0.08);
	--border-hover: rgba(255, 255, 255, 0.15);
	--radius: 12px;
	--radius-lg: 16px;
}

html {
	scroll-behavior: smooth;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: 'Space Grotesk', system-ui, sans-serif;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

::selection {
	background: var(--accent);
	color: var(--bg);
}

/* ============================================
   HERO
   ============================================ */
.hero {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 2rem;
	position: relative;
	background: radial-gradient(ellipse at center, var(--surface) 0%, var(--bg) 70%);
}

.hero-content {
	max-width: 600px;
}

.hero-title {
	font-family: 'Syne', sans-serif;
	font-size: clamp(3rem, 10vw, 5rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.05;
	margin-bottom: 1rem;
}

.hero-subtitle {
	font-size: 1.25rem;
	color: var(--text-muted);
	margin-bottom: 3rem;
}

.scroll-hint {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	color: var(--text-muted);
	font-size: 0.85rem;
	animation: bounce 2s ease-in-out infinite;
}

.scroll-hint svg {
	color: var(--accent);
}

@keyframes bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(8px); }
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
	max-width: 900px;
	margin: 0 auto;
	padding: 4rem 2rem 8rem;
}

/* ============================================
   PAGE BADGE
   ============================================ */
.page-badge {
	display: inline-block;
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.7rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: var(--accent);
	background: var(--accent-dim);
	padding: 0.4rem 0.8rem;
	border-radius: 100px;
	margin-bottom: 1.5rem;
}

/* ============================================
   BROWSER NOTICE
   ============================================ */
.browser-notice {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem 1.25rem;
	margin-bottom: 4rem;
	font-size: 0.9rem;
}

.browser-notice-icon {
	color: var(--accent);
	flex-shrink: 0;
	margin-top: 0.1rem;
}

.browser-notice-content {
	color: var(--text-muted);
}

.browser-notice-content strong {
	color: var(--text);
}

.browser-notice-content a {
	color: var(--accent);
	text-decoration: none;
}

.browser-notice-content a:hover {
	text-decoration: underline;
}

/* ============================================
   EXAMPLE SECTIONS
   ============================================ */
.example {
	margin-bottom: 6rem;
}

.example:last-child {
	margin-bottom: 0;
}

.example-header {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.example-number {
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.75rem;
	color: var(--accent);
	letter-spacing: 0.1em;
}

.example-title {
	font-size: 0.8rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--text-muted);
}

.example-content {
	margin-bottom: 1.5rem;
}

.example-instruction {
	font-size: 0.95rem;
	color: var(--text-muted);
	margin-bottom: 1.5rem;
}

.example-instruction code {
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.85em;
	background: var(--surface);
	padding: 0.2em 0.4em;
	border-radius: 4px;
}

/* ============================================
   DEMO AREA
   ============================================ */
.demo-area {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	position: relative;
	/* Removed overflow: hidden to avoid creating a local scroll container */
}

.demo-area::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
	opacity: 0.03;
	pointer-events: none;
	border-radius: inherit;
}

/* ============================================
   DEMO GRIDS
   ============================================ */
.demo-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.25rem;
}

.demo-grid--2col {
	grid-template-columns: repeat(2, 1fr);
}

.demo-grid--4col {
	grid-template-columns: repeat(4, 1fr);
}

.demo-split {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.5rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem;
	text-align: center;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
	border-color: var(--border-hover);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card h3 {
	font-family: 'Syne', sans-serif;
	font-size: 1.1rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
}

.card p {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.card--large {
	padding: 0;
	overflow: hidden;
	text-align: left;
}

.card--large .card-body {
	padding: 1.25rem;
}

.card--small {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.card-icon {
	color: var(--accent);
	margin-bottom: 1rem;
}

.card-number {
	font-family: 'Syne', sans-serif;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--accent);
}

.card-image {
	height: 140px;
	display: flex;
	align-items: flex-end;
	padding: 1rem;
}

.card-label {
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(8px);
	padding: 0.35rem 0.65rem;
	border-radius: 4px;
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.code-block {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}

.code-block pre {
	padding: 1.25rem;
	overflow-x: auto;
}

.code-block code {
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.8rem;
	line-height: 1.7;
	color: var(--text-muted);
}

/* ============================================
   INFO SECTION
   ============================================ */
.example--info .example-number {
	background: var(--accent-dim);
	padding: 0.5rem;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.example--info .example-number svg {
	color: var(--accent);
}

.info-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.25rem;
}

.info-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem;
}

.info-card h3 {
	font-size: 0.85rem;
	font-weight: 600;
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--border);
}

.info-card--positive h3 {
	color: var(--accent);
}

.info-card--neutral h3 {
	color: var(--text-muted);
}

.info-card ul {
	list-style: none;
}

.info-card li {
	font-size: 0.85rem;
	color: var(--text-muted);
	padding: 0.35rem 0;
	padding-left: 1.25rem;
	position: relative;
}

.info-card li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.75rem;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--border-hover);
}

.info-card--positive li::before {
	background: var(--accent);
}

/* ============================================
   CSS SCROLL-DRIVEN ANIMATIONS
   ============================================ */

/* Fade In */
.reveal-fade {
	animation-name: fade-in;
	animation-duration: auto;
	animation-timing-function: linear;
	animation-fill-mode: both;
	animation-timeline: view();
	animation-range: entry 0% cover 40%;
	will-change: opacity;
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Slide Up */
.reveal-slide-up {
	animation-name: slide-up;
	animation-duration: auto;
	animation-timing-function: linear;
	animation-fill-mode: both;
	animation-timeline: view();
	animation-range: entry 0% cover 40%;
	will-change: transform, opacity;
}

@keyframes slide-up {
	from {
		opacity: 0;
		transform: translateY(50px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Scale In */
.reveal-scale {
	animation-name: scale-in;
	animation-duration: auto;
	animation-timing-function: linear;
	animation-fill-mode: both;
	animation-timeline: view();
	animation-range: entry 0% cover 40%;
	will-change: transform, opacity;
}

@keyframes scale-in {
	from {
		opacity: 0;
		transform: scale(0.85);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Slide from Left */
.reveal-slide-left {
	animation-name: slide-left;
	animation-duration: auto;
	animation-timing-function: linear;
	animation-fill-mode: both;
	animation-timeline: view();
	animation-range: entry 0% cover 40%;
	will-change: transform, opacity;
}

@keyframes slide-left {
	from {
		opacity: 0;
		transform: translateX(-50px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* Slide from Right */
.reveal-slide-right {
	animation-name: slide-right;
	animation-duration: auto;
	animation-timing-function: linear;
	animation-fill-mode: both;
	animation-timeline: view();
	animation-range: entry 0% cover 40%;
	will-change: transform, opacity;
}

@keyframes slide-right {
	from {
		opacity: 0;
		transform: translateX(50px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}


/* JS Fallback States */
.no-scroll-timeline .reveal-fade,
.no-scroll-timeline .reveal-slide-up,
.no-scroll-timeline .reveal-scale,
.no-scroll-timeline .reveal-slide-left,
.no-scroll-timeline .reveal-slide-right {
	opacity: 0;
}

.no-scroll-timeline .reveal-ready {
	opacity: 1;
	transform: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
	.container {
		padding: 2rem 1.25rem 6rem;
	}

	.page-header {
		margin-bottom: 2rem;
	}

	.browser-notice {
		flex-direction: column;
		gap: 0.75rem;
		margin-bottom: 3rem;
	}

	.example {
		margin-bottom: 4rem;
	}

	.demo-area {
		padding: 1.5rem;
	}

	.demo-grid {
		grid-template-columns: 1fr;
	}

	.demo-grid--2col {
		grid-template-columns: 1fr;
	}

	.demo-grid--4col {
		grid-template-columns: repeat(2, 1fr);
	}

	.demo-split {
		grid-template-columns: 1fr;
	}

	.info-grid {
		grid-template-columns: 1fr;
	}

	.code-block pre {
		padding: 1rem;
	}

	.code-block code {
		font-size: 0.75rem;
	}
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-delay: 0ms !important;
		transition-duration: 0.01ms !important;
	}

	.reveal-fade,
	.reveal-slide-up,
	.reveal-scale,
	.reveal-slide-left,
	.reveal-slide-right {
		animation: none;
		opacity: 1;
		transform: none;
	}
}

/* ============================================
   FALLBACK FOR UNSUPPORTED BROWSERS
   ============================================ */
@supports not (animation-timeline: view()) {
	.reveal-fade,
	.reveal-slide-up,
	.reveal-scale,
	.reveal-slide-left,
	.reveal-slide-right {
		animation: none;
		opacity: 1;
		transform: none;
	}

	.browser-notice {
		background: rgba(200, 255, 0, 0.05);
		border-color: var(--accent);
	}
}

.no-scroll-timeline .reveal-fade,
.no-scroll-timeline .reveal-slide-up,
.no-scroll-timeline .reveal-scale,
.no-scroll-timeline .reveal-slide-left,
.no-scroll-timeline .reveal-slide-right {
	animation: none;
	opacity: 1;
	transform: none;
}

Pure CSS scroll-triggered entrance animations. No JavaScript required.

Browser Support

CSS scroll-driven animations work in:

  • Chrome 115+
  • Edge 115+
  • Safari 18+

Check caniuse.com for current support.

Quick Start

1. Add the CSS to your stylesheet or <style> tag:

.reveal-fade {
  animation: fade-in auto linear both;
  animation-timeline: view();
  animation-range: entry 0% cover 40%;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

2. Add the class to any HTML element:

<div class="reveal-fade">This fades in on scroll</div>

Available Classes

Class Effect
.reveal-fade Fade from transparent to opaque
.reveal-slide-up Fade + slide up from below
.reveal-scale Fade + scale from 0.85 to 1
.reveal-slide-left Fade + slide in from left
.reveal-slide-right Fade + slide in from right

Examples

Basic Fade

HTML:

<div class="reveal-fade">
  Content fades in as it enters the viewport
</div>

Slide Up

HTML:

<div class="reveal-slide-up">
  Content slides up while fading in
</div>

Scale In

HTML:

<div class="reveal-scale">
  Content grows from 85% to 100% size
</div>

Side Slides

HTML:

<div class="reveal-slide-left">From the left</div>
<div class="reveal-slide-right">From the right</div>

Customization

Add these to your stylesheet or <style> tag to customize behavior.

Animation Range

Control when the animation starts and ends:

CSS:

.reveal-fade {
  /* Default: animate during entry */
  animation-range: entry 0% cover 40%;

  /* Start when 20% visible, complete at 80% */
  animation-range: entry 20% entry 80%;

  /* Animate through the entire visibility */
  animation-range: cover 0% cover 100%;
}

Animation Speed

The linear timing function ties animation directly to scroll. For smoother motion, use easing:

CSS:

.reveal-fade {
  animation: fade-in auto ease-out both;
}

Custom Keyframes

Create your own animations:

CSS:

.reveal-rotate {
  animation: rotate-in auto linear both;
  animation-timeline: view();
  animation-range: entry 0% cover 40%;
}

@keyframes rotate-in {
  from {
    opacity: 0;
    transform: rotate(-10deg) translateY(30px);
  }
  to {
    opacity: 1;
    transform: rotate(0) translateY(0);
  }
}

Accessibility

The effect respects prefers-reduced-motion:

CSS:

@media (prefers-reduced-motion: reduce) {
  .reveal-fade,
  .reveal-slide-up,
  .reveal-scale,
  .reveal-slide-left,
  .reveal-slide-right {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

Fallback for Unsupported Browsers

This demo is designed to show pure CSS capabilities. In unsupported browsers, content will simply be visible without animation:

CSS:

@supports not (animation-timeline: view()) {
  .reveal-fade,
  .reveal-slide-up,
  .reveal-scale,
  .reveal-slide-left,
  .reveal-slide-right {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

For production sites requiring broad browser support and complex features (pinning, scrubbing, callbacks), we recommend using GSAP ScrollTrigger.

Dependencies

None. Pure CSS.

Your Cart

Your cart is empty

Browse Effects