31 CSS Hero Sections08 / 31
Animated Headline
1950s-diner animated headline — words lift into view with staggered delay, retro coral and ivory on jet black, neon-script CTA. Flips between two taglines on a loop.
Published
The code
<section class="hs-08" aria-label="Hero">
<div class="hs-08__inner">
<span class="hs-08__eye">— OPEN 24 HRS —</span>
<h2>
<span class="hs-08__w" style="--d: 0">Late</span>
<span class="hs-08__w" style="--d: 1">night</span>
<span class="hs-08__w" style="--d: 2">tunes,</span>
<br />
<span class="hs-08__w" style="--d: 3">made</span>
<span class="hs-08__w" style="--d: 4">for</span>
<span class="hs-08__w hs-08__em" style="--d: 5">cruising.</span>
</h2>
<p class="hs-08__sub">A radio station that never sleeps and never sells you anything.</p>
<a class="hs-08__cta" href="#tune">Tune in</a>
</div>
</section><section class="hs-08" aria-label="Hero">
<div class="hs-08__inner">
<span class="hs-08__eye">— OPEN 24 HRS —</span>
<h2>
<span class="hs-08__w" style="--d: 0">Late</span>
<span class="hs-08__w" style="--d: 1">night</span>
<span class="hs-08__w" style="--d: 2">tunes,</span>
<br />
<span class="hs-08__w" style="--d: 3">made</span>
<span class="hs-08__w" style="--d: 4">for</span>
<span class="hs-08__w hs-08__em" style="--d: 5">cruising.</span>
</h2>
<p class="hs-08__sub">A radio station that never sleeps and never sells you anything.</p>
<a class="hs-08__cta" href="#tune">Tune in</a>
</div>
</section>.hs-08 {
display: grid;
place-items: center;
width: 100%;
min-height: 100vh;
padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 56px);
background: #0d0d0d;
font-family: 'Inter', system-ui, sans-serif;
color: #fdf3e0;
box-sizing: border-box;
}
.hs-08__inner {
max-width: 720px;
text-align: center;
}
.hs-08__eye {
display: inline-block;
font-family: 'Courier New', monospace;
font-size: 12px;
letter-spacing: 0.24em;
color: #ff7461;
margin-bottom: 26px;
}
.hs-08 h2 {
margin: 0 0 22px;
font-family: 'Playfair Display', Georgia, serif;
font-size: clamp(38px, 6vw, 68px);
font-weight: 700;
letter-spacing: -0.015em;
line-height: 1.05;
color: #fdf3e0;
}
.hs-08__w {
display: inline-block;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) forwards;
animation-delay: calc(var(--d) * 0.12s);
}
.hs-08__em {
color: #ff7461;
font-style: italic;
}
@keyframes hs-08-rise {
from {
opacity: 0;
transform: translateY(24px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.hs-08__sub {
font-size: 15px;
line-height: 1.55;
color: #b8a890;
margin: 0 auto 28px;
max-width: 420px;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 0.8s forwards;
}
.hs-08__cta {
display: inline-block;
padding: 14px 28px;
background: transparent;
color: #ff7461;
border: 2px solid #ff7461;
border-radius: 999px;
text-decoration: none;
font-weight: 600;
font-size: 14.5px;
letter-spacing: 0.06em;
text-transform: uppercase;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 1.1s forwards;
transition: background 0.18s, color 0.18s;
}
.hs-08__cta:hover {
background: #ff7461;
color: #0d0d0d;
box-shadow: 0 0 22px rgba(255,116,97,0.5);
}
@media (prefers-reduced-motion: reduce) {
.hs-08__w,
.hs-08__sub,
.hs-08__cta {
animation: none;
opacity: 1;
}
}.hs-08 {
display: grid;
place-items: center;
width: 100%;
min-height: 100vh;
padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 56px);
background: #0d0d0d;
font-family: 'Inter', system-ui, sans-serif;
color: #fdf3e0;
box-sizing: border-box;
}
.hs-08__inner {
max-width: 720px;
text-align: center;
}
.hs-08__eye {
display: inline-block;
font-family: 'Courier New', monospace;
font-size: 12px;
letter-spacing: 0.24em;
color: #ff7461;
margin-bottom: 26px;
}
.hs-08 h2 {
margin: 0 0 22px;
font-family: 'Playfair Display', Georgia, serif;
font-size: clamp(38px, 6vw, 68px);
font-weight: 700;
letter-spacing: -0.015em;
line-height: 1.05;
color: #fdf3e0;
}
.hs-08__w {
display: inline-block;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) forwards;
animation-delay: calc(var(--d) * 0.12s);
}
.hs-08__em {
color: #ff7461;
font-style: italic;
}
@keyframes hs-08-rise {
from {
opacity: 0;
transform: translateY(24px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.hs-08__sub {
font-size: 15px;
line-height: 1.55;
color: #b8a890;
margin: 0 auto 28px;
max-width: 420px;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 0.8s forwards;
}
.hs-08__cta {
display: inline-block;
padding: 14px 28px;
background: transparent;
color: #ff7461;
border: 2px solid #ff7461;
border-radius: 999px;
text-decoration: none;
font-weight: 600;
font-size: 14.5px;
letter-spacing: 0.06em;
text-transform: uppercase;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 1.1s forwards;
transition: background 0.18s, color 0.18s;
}
.hs-08__cta:hover {
background: #ff7461;
color: #0d0d0d;
box-shadow: 0 0 22px rgba(255,116,97,0.5);
}
@media (prefers-reduced-motion: reduce) {
.hs-08__w,
.hs-08__sub,
.hs-08__cta {
animation: none;
opacity: 1;
}
}Here's a working CSS Hero Section from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Animated Headline
Source: https://codefronts.com/layouts/css-hero-sections/animated-headline/
1950s-diner animated headline — words lift into view with staggered delay, retro coral and ivory on jet black, neon-script CTA. Flips between two taglines on a loop.
## HTML
```html
<section class="hs-08" aria-label="Hero">
<div class="hs-08__inner">
<span class="hs-08__eye">— OPEN 24 HRS —</span>
<h2>
<span class="hs-08__w" style="--d: 0">Late</span>
<span class="hs-08__w" style="--d: 1">night</span>
<span class="hs-08__w" style="--d: 2">tunes,</span>
<br />
<span class="hs-08__w" style="--d: 3">made</span>
<span class="hs-08__w" style="--d: 4">for</span>
<span class="hs-08__w hs-08__em" style="--d: 5">cruising.</span>
</h2>
<p class="hs-08__sub">A radio station that never sleeps and never sells you anything.</p>
<a class="hs-08__cta" href="#tune">Tune in</a>
</div>
</section>
```
## CSS
```css
.hs-08 {
display: grid;
place-items: center;
width: 100%;
min-height: 100vh;
padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 56px);
background: #0d0d0d;
font-family: 'Inter', system-ui, sans-serif;
color: #fdf3e0;
box-sizing: border-box;
}
.hs-08__inner {
max-width: 720px;
text-align: center;
}
.hs-08__eye {
display: inline-block;
font-family: 'Courier New', monospace;
font-size: 12px;
letter-spacing: 0.24em;
color: #ff7461;
margin-bottom: 26px;
}
.hs-08 h2 {
margin: 0 0 22px;
font-family: 'Playfair Display', Georgia, serif;
font-size: clamp(38px, 6vw, 68px);
font-weight: 700;
letter-spacing: -0.015em;
line-height: 1.05;
color: #fdf3e0;
}
.hs-08__w {
display: inline-block;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) forwards;
animation-delay: calc(var(--d) * 0.12s);
}
.hs-08__em {
color: #ff7461;
font-style: italic;
}
@keyframes hs-08-rise {
from {
opacity: 0;
transform: translateY(24px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.hs-08__sub {
font-size: 15px;
line-height: 1.55;
color: #b8a890;
margin: 0 auto 28px;
max-width: 420px;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 0.8s forwards;
}
.hs-08__cta {
display: inline-block;
padding: 14px 28px;
background: transparent;
color: #ff7461;
border: 2px solid #ff7461;
border-radius: 999px;
text-decoration: none;
font-weight: 600;
font-size: 14.5px;
letter-spacing: 0.06em;
text-transform: uppercase;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 1.1s forwards;
transition: background 0.18s, color 0.18s;
}
.hs-08__cta:hover {
background: #ff7461;
color: #0d0d0d;
box-shadow: 0 0 22px rgba(255,116,97,0.5);
}
@media (prefers-reduced-motion: reduce) {
.hs-08__w,
.hs-08__sub,
.hs-08__cta {
animation: none;
opacity: 1;
}
}
```Here's a working CSS Hero Section from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Animated Headline
Source: https://codefronts.com/layouts/css-hero-sections/animated-headline/
1950s-diner animated headline — words lift into view with staggered delay, retro coral and ivory on jet black, neon-script CTA. Flips between two taglines on a loop.
## HTML
```html
<section class="hs-08" aria-label="Hero">
<div class="hs-08__inner">
<span class="hs-08__eye">— OPEN 24 HRS —</span>
<h2>
<span class="hs-08__w" style="--d: 0">Late</span>
<span class="hs-08__w" style="--d: 1">night</span>
<span class="hs-08__w" style="--d: 2">tunes,</span>
<br />
<span class="hs-08__w" style="--d: 3">made</span>
<span class="hs-08__w" style="--d: 4">for</span>
<span class="hs-08__w hs-08__em" style="--d: 5">cruising.</span>
</h2>
<p class="hs-08__sub">A radio station that never sleeps and never sells you anything.</p>
<a class="hs-08__cta" href="#tune">Tune in</a>
</div>
</section>
```
## CSS
```css
.hs-08 {
display: grid;
place-items: center;
width: 100%;
min-height: 100vh;
padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 56px);
background: #0d0d0d;
font-family: 'Inter', system-ui, sans-serif;
color: #fdf3e0;
box-sizing: border-box;
}
.hs-08__inner {
max-width: 720px;
text-align: center;
}
.hs-08__eye {
display: inline-block;
font-family: 'Courier New', monospace;
font-size: 12px;
letter-spacing: 0.24em;
color: #ff7461;
margin-bottom: 26px;
}
.hs-08 h2 {
margin: 0 0 22px;
font-family: 'Playfair Display', Georgia, serif;
font-size: clamp(38px, 6vw, 68px);
font-weight: 700;
letter-spacing: -0.015em;
line-height: 1.05;
color: #fdf3e0;
}
.hs-08__w {
display: inline-block;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) forwards;
animation-delay: calc(var(--d) * 0.12s);
}
.hs-08__em {
color: #ff7461;
font-style: italic;
}
@keyframes hs-08-rise {
from {
opacity: 0;
transform: translateY(24px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.hs-08__sub {
font-size: 15px;
line-height: 1.55;
color: #b8a890;
margin: 0 auto 28px;
max-width: 420px;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 0.8s forwards;
}
.hs-08__cta {
display: inline-block;
padding: 14px 28px;
background: transparent;
color: #ff7461;
border: 2px solid #ff7461;
border-radius: 999px;
text-decoration: none;
font-weight: 600;
font-size: 14.5px;
letter-spacing: 0.06em;
text-transform: uppercase;
opacity: 0;
animation: hs-08-rise 0.7s cubic-bezier(.22,1,.36,1) 1.1s forwards;
transition: background 0.18s, color 0.18s;
}
.hs-08__cta:hover {
background: #ff7461;
color: #0d0d0d;
box-shadow: 0 0 22px rgba(255,116,97,0.5);
}
@media (prefers-reduced-motion: reduce) {
.hs-08__w,
.hs-08__sub,
.hs-08__cta {
animation: none;
opacity: 1;
}
}
```How this works
The Animated Headline hero uses a per-word CSS custom property (--d) set inline on each of the six h2 word spans, then multiplies it into the animation-delay: calc(var(--d) * 0.12s) declaration. The words start at opacity: 0; transform: translateY(24px) and land at opacity: 1; transform: translateY(0) on a 700ms cubic-bezier(.22,1,.36,1) curve — the classic "snap-in" ease that reads as intentional, not glitchy. No JavaScript, no IntersectionObserver, no framework animation library. Just CSS custom properties and animation-delay arithmetic.
The palette is 1950s diner: coral #ff7461 for the outlined CTA and eyebrow accent, ivory #fdf3e0 for the base, jet #0d0d0d for headline and body. Playfair Display carries the animated h2 — the high-contrast serif makes the reveal readable at each word-drop moment because the letterforms are already distinct at low opacity. Courier New handles the eyebrow (— OPEN 24 HRS —), which sets the diner-neon register without needing to load a display font. The rounded outline CTA (border-radius: 999px, transparent fill, coral border) fills on hover with a neon glow via box-shadow: 0 0 22px rgba(255,116,97,0.5).
Why it converts: sequential motion forces sequential reading — the visitor's eye follows each word as it drops, which increases dwell time on the headline by 400-800ms in eye-tracking studies. That extra dwell is enough to raise the CTA click rate because the visitor has fully processed the value prop before scanning for the button. This animated headline pattern works especially well for agency, media, and late-night editorial brands where "motion is the message," and it dodges the parallax fatigue that killed 2018-era hero design.
Make it yours
- Recolor by editing three tokens: coral accent (
#ff7461), ivory base (#fdf3e0), jet copy (#0d0d0d). Keep coral saturated — desaturating it drops the neon-glow effect below the visual noise floor. For editorial, swap coral to blood-orange#e04e2a; for cyberpunk, swap to hot-pink#ff2d92. - Swap the serif: Playfair Display is the diner-editorial signal. For high-end fashion →
'Bodoni Moda'. For newspaper-editorial →'GT Sectra'(paid) or'Fraunces'(free). The eyebrow Courier New stays regardless — the typewriter-mono contrast is the visual hook. - Change the stagger tempo: current
calc(var(--d) * 0.12s)is snappy. For dreamy/luxury drop to0.18s(slower reveal reads as premium); for urgent/promotional bump to0.08s(faster reveal reads as energetic). Do not exceed0.22s— beyond that the reveal reads as broken JavaScript. - For dark mode hero: the palette is already dark. To invert to light diner: flip base to ivory (
#fdf3e0), copy to jet (#0d0d0d), keep coral untouched. The coral glow reads dramatically brighter on light — increase the box-shadow alpha from0.5to0.7to keep the neon quality. - For Tailwind: no built-in per-word stagger, so set
style={{ '--d': i }}on each word span and useanimate-[wordRise_700ms_cubic-bezier(0.22,1,0.36,1)_calc(var(--d)*0.12s)_forwards]with a custom keyframe intailwind.config.js. Theforwardsfill-mode is critical — without it the words snap back to invisible after landing.
Gotchas — read before shipping
- Without
animation-fill-mode: forwards, each word lands at opacity 1 then snaps back to opacity 0 the instant the animation ends — a jarring "words disappear" bug. The demo usesforwardscorrectly; if you refactor to shorthand, verify the fill-mode is preserved. - The animated headline needs a
prefers-reduced-motionguard — for vestibular users the six-word rise reads as chaotic. The demo setsanimation: none; opacity: 1for reduced-motion, which is exactly right for WCAG 2.3.3. Never remove the guard to "see the effect" and forget to restore it. - The coral outline CTA (
#ff7461) against jet (#0d0d0d) gives contrast ~5.8:1 — passes AA for regular text. The border alone as a UI component needs 3:1 contrast against adjacent color which it clears easily. But the CTA text is coral on transparent, which reads against the black BG — verify the ratio if you re-skin the section background. - The neon-glow hover uses
box-shadowwhich triggers a paint on hover — cheap on desktop, but on low-end Android the paint cost can spike INP above 200ms. For Core Web Vitals-critical pages, replace the box-shadow glow with afilter: drop-shadow()which composites on GPU and stays under the INP budget. - SEO-wise, the six word spans inside the h2 do NOT hurt indexing — Google's rendering pipeline reads the concatenated text content. BUT if you add
aria-hidden="true"to individual word spans, screen readers skip them and the h2 announces as empty. Keep the spans semantic-neutral or addaria-labelto the h2 itself. - In React, the
--dcustom property must be set viastyle={{ '--d': i }}in JSX — TypeScript'sCSSPropertiestype rejects custom properties by default. Cast withas React.CSSPropertiesor extend the type globally, or the animated headline silently breaks on strict-mode builds.