parallax /
Classic Fixed Background
CSS background-attachment: fixed. The cheapest, oldest parallax — zero JS, perfect 60fps on desktop, gracefully degrades to a scroll on iOS Safari.
Preview
Source
tsx
export interface ParallaxClassicFixedProps {
imageSrc?: string;
eyebrow?: string;
headline?: string;
subhead?: string;
}
export default function ParallaxClassicFixed({
imageSrc = "/heroes/landscape-card-bg.webp",
eyebrow = "Parallax · 01",
headline = "Classic fixed background",
subhead =
"Pure CSS background-attachment: fixed. Zero JavaScript. The viewport scrolls over a stationary image. Falls back to scroll on iOS Safari.",
}: ParallaxClassicFixedProps) {
return (
<section
className="relative isolate flex min-h-[140svh] w-full items-center justify-center overflow-hidden bg-slate-900"
style={{
backgroundImage: `url(${imageSrc})`,
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
backgroundAttachment: "fixed",
}}
>
<div className="absolute inset-0 -z-0 bg-gradient-to-b from-black/55 via-black/30 to-black/70" />
<div className="relative z-10 mx-auto max-w-3xl px-6 text-center text-white">
<p className="mb-4 text-xs font-semibold uppercase tracking-[0.3em] text-white/70">
{eyebrow}
</p>
<h1 className="text-balance text-4xl font-semibold leading-[1.1] tracking-tight sm:text-6xl">
{headline}
</h1>
<p className="mx-auto mt-6 max-w-xl text-base leading-relaxed text-white/80 sm:text-lg">
{subhead}
</p>
</div>
</section>
);
} Claude Code Instructions
CLI Install
npx innovations add classic-fixedWhere to use it
Drop on a marketing page where you want the cheapest possible parallax. No JS, no setup.
In Astro:
---
import ParallaxClassicFixed from '../components/innovations/parallax/classic-fixed';
---
<ParallaxClassicFixed imageSrc="/your-image.webp" />
CAVEAT: background-attachment: fixed silently degrades to background-attachment: scroll on iOS Safari (mobile). The image stays positioned but doesn't pin — you lose the parallax on iPhone. There is no fix; this is a Safari decision. If iOS parity matters, use translate-y or sticky-pin instead.
WHEN TO USE:
- Desktop-first marketing pages
- Brochure / portfolio sections where the parallax is a nice-to-have, not the point
- You want zero JS shipped
ASSETS: needs one wide image (1600–2000px). Aim for 80–180 KB WebP. Mid-tone luminance works best so overlay text stays readable.