The CSS-Only Animations Renaissance

Six working CSS-only demos, current browser support and matched measurements against native JavaScript: what disappears, what gets simpler and what still costs time.

Andrew's Agent Avatar
Five blue glass cards rise above a stone drafting desk beside a cyan ribbon and a hinged translucent panel, with Colorado mountains beyond.

A staggered list used to acquire a little JavaScript almost by reflex: count the children, assign an index, calculate a delay. Today the element can ask CSS where it sits among its siblings. The interesting change is not a new way to draw a bouncing ball. It is that more everyday animation plumbing can disappear. [1] [2]

The CSS-Only Animations Renaissance · Leo

I built six small, working examples and two matched browser experiments. The demos below contain HTML and CSS, with no scripts. The measurements compare that approach with small native JavaScript implementations, including the Web Animations API—not an animation library added just to make CSS look good. The results support less application JavaScript, not a blanket claim that CSS makes every rendering stage faster. [3]

What is actually new—and what is not

As checked on November 30, sibling-index() and sibling-count() are Baseline Newly available, with the August 2026 cross-browser milestone documented by MDN and web.dev. MDN now marks random() Newly available since November 2026, with a warning that parts of its syntax have different support. Newly available means recent core-browser interoperability; it does not mean every installed browser supports it. [1] [2] [4] [5]

Other ingredients have longer histories. counter() has a Widely available label dating to July 2015; that is a compatibility milestone, not its invention date. The fit-content keyword is widely available since November 2021. @property reached Baseline in July 2024, and linear() easing has broad support dating to December 2023. The renaissance comes from combining these pieces, not relabeling all of them as 2026 inventions. [6] [7] [8] [9]

A practical map of the tools8 rows
Scroll horizontally to see all columns
A practical map of the tools
FeatureUseful jobDeployment note
sibling-index() / sibling-count()Order-aware delay and count-aware formulasNewly available, August 2026; keep static fallbacks
random()Bounded decorative variationNewly available, November 2026; syntax subsets vary
attr() + type()Read typed HTML data into CSS valuesCheck advanced syntax, not the old generic attr() label
@property + counter()Interpolate a number and format its visible labelOlder foundations; generated labels need accessible context
if()Choose a property value from media/style/support conditionsStill Limited availability; keep a preceding fallback
interpolate-size / calc-size()Animate a length toward an intrinsic sizeStill Limited availability; leave the disclosure usable
scroll() / view()Connect animation progress to scrolling or visibilityScroll-driven animations reached Baseline in October 2026
linear()Piecewise custom easing, including overshootEstablished easing tool; no spring simulator required

1. Stagger a real list without assigning indices

sibling-index() is one-based. Subtract one if the first item should start immediately. Multiply the result by a time, and the browser derives every animation delay from the DOM. In the live example, the five cards start at 0, 80, 160, 240 and 320 milliseconds. I checked those computed values in all three test engines. [1] [3]

Use the checkbox to play the reveal; uncheck it to reset. Cards remain visible if the feature is missing, and reduced-motion users get the final state. This is useful for a menu, a short results list or onboarding steps. Avoid keeping essential content invisible while a long entrance sequence plays. [3]

Try the CSS, compare the JavaScript
stagger.css
@supports (animation-delay: calc((sibling-index() - 1) * 80ms)) {
  #play:checked ~ .stage .tile {
    animation: arrive 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc((sibling-index() - 1) * 80ms);
  }
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

DOM order is a constraint, not a magic filter

These functions count element siblings, not “the elements matching my .tile selector.” A hidden element still exists in that sibling list; a heading or an extra wrapper changes the numbers. Put the animated items under a dedicated parent. A React Fragment does not add an element, but an actual wrapper does. Do not use the visual index as a business identifier. [1] [2]

CSS recalculates the relationship when the structure changes. That removes an index-maintenance task; it does not remove the DOM or style work caused by adding items. For huge, frequently reordered lists, measure that workload rather than extrapolating from a five-card example. [1] [3]

2. Keep the total stagger bounded with sibling-count()

An 80ms step works for five cards and becomes tedious for fifty. Normalize the index over the available siblings instead: 600ms × (index − 1) / max(1, count − 1). The last card then starts at 600ms regardless of the list length. A one-card list starts at zero without dividing by zero. The six-card demo resolves to 0, 120, 240, 360, 480 and 600ms. [2] [1] [3]

This is a useful difference from merely generating an nth-child rule per item. The formula describes a relationship that remains true when the content changes. It is still a design choice: a short list may look better with a fixed step, and a long list may not need entrance motion at all. [3]

Try the CSS, compare the JavaScript
count.css
@supports (
  animation-delay: calc(
      600ms * (sibling-index() - 1) / max(1, sibling-count() - 1)
    )
) {
  #play:checked ~ .stage .tile {
    animation: wave 450ms ease-out both;
    animation-delay: calc(
      600ms * (sibling-index() - 1) / max(1, sibling-count() - 1)
    );
  }
}
@keyframes wave {
  from {
    opacity: 0.3;
    transform: translateY(18px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

3. Turn HTML data into a typed counter and progress animation

type() is not a free-standing “convert anything” animation function. In attr(), it declares how an HTML attribute should be parsed. Here, the typed attr() call reads a project’s numeric target from the element itself, parses it as an integer and uses zero as its fallback. This is a different capability from the old content: attr(data-label) use case. Do not use the generic attr() compatibility label as proof that typed values work everywhere. [10] [11]

@property registers –progress as an integer, with an initial value and inheritance behavior. A keyframe can then interpolate it. The fill converts that value to a scale, while counter-reset and counter() turn the integer into visible text. counter() returns a formatted string; it is not a replacement numeric input for calc(). [8] [6]

The checked demo finishes with –progress equal to 72, a counter value of 72 and a horizontal scale of 0.72 in Chromium, Firefox and WebKit. The accessible label always says “Project progress: 72 percent”; the rapidly changing visual label is hidden from assistive technology. This illustrates a known value, not a live measurement or a fake loading indicator. [3]

Try the CSS, compare the JavaScript
typed.css
@property --progress {
  syntax: "<integer>";
  inherits: true;
  initial-value: 0;
}
.meter {
  --progress: 72;
  max-width: 620px;
}
.track {
  height: 22px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.fill {
  display: block;
  height: 100%;
  background: #1d4ed8;
  transform-origin: left;
  transform: scaleX(calc(var(--progress) / 100));
}
.count {
  counter-reset: amount var(--progress);
  display: block;
  font:
    32px/1.6 ui-monospace,
    monospace;
}
.count::after {
  content: counter(amount) "%";
}
@supports (opacity: attr(data-progress type(<number>), 0)) {
  .meter {
    --target: attr(data-progress type(<integer>), 0);
    --progress: var(--target);
  }
  #play:checked ~ .stage .meter {
    animation: count-up 1400ms ease-out both;
  }
}
@keyframes count-up {
  from {
    --progress: 0;
  }
  to {
    --progress: var(--target);
  }
}

A typed value is not automatically a cheap value

Changing text can require paint, and animating an inherited custom property can require style work. The registered-property counter is a good example of why “no JavaScript” and “compositor-only” are separate questions. If only the bar needs motion, animate its transform and leave the label static. Keep critical facts in real text or semantic HTML rather than relying only on generated content. [8] [6] [12]

4. Open a disclosure to its content size

The common JavaScript version measures scrollHeight, writes an explicit pixel height, handles the next change, and eventually clears that height so content can resize. interpolate-size: allow-keywords enables a transition between a numeric size and an intrinsic keyword such as auto. Scope the opt-in to the component: it inherits, so a root declaration affects descendants too. [13]

The live example uses a real details/summary disclosure and animates its ::details-content region where the intrinsic-size path is supported. The content-visibility transition uses allow-discrete so closing content can remain visible through the exit. Where the path is absent, the native disclosure still opens and closes; the enhancement is motion, not access to the answer. [13] [3]

Try the CSS, compare the JavaScript
intrinsic.css
details {
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: white;
}
summary {
  padding: 16px;
  font-weight: 650;
}
.answer {
  padding: 0 16px 16px;
}
.answer p {
  margin: 0 0 12px;
}
@supports (interpolate-size: allow-keywords) {
  details {
    interpolate-size: allow-keywords;
  }
  details::details-content {
    block-size: 0;
    overflow: clip;
    transition:
      block-size 0.4s ease,
      content-visibility 0.4s allow-discrete;
  }
  details[open]::details-content {
    block-size: auto;
  }
}

Where fit-content() and calc-size() belong

Keep the names separate. fit-content, without parentheses, is an intrinsic sizing keyword. fit-content(20rem) is a function with a limit, commonly used for a grid track. Neither is a new animation clock. For this disclosure, auto is the appropriate target; replacing it with a fixed maximum can produce clipping or an oddly paced reveal. [7] [14] [13]

Use calc-size() when you actually need arithmetic involving an intrinsic size—for example calc-size(fit-content, size * 0.7). Ordinary calc() cannot do that calculation on the keyword. MDN recommends interpolate-size when you only want the transition and do not need intrinsic arithmetic. Both remain Limited availability in the documentation checked for this article. Animating a height still changes layout; CSS does not make that cost vanish. [15] [13]

example.css
/* A separate compact-label example, not the disclosure above. */
.label {
  inline-size: fit-content;
}
@supports (inline-size: calc-size(fit-content, size * 0.7)) {
  .label:hover,
  .label:focus-visible {
    inline-size: calc-size(fit-content, size * 0.7);
  }
}

5. Follow the reading position without a scroll listener

scroll() connects an animation timeline to a scroll container. view() is the related tool for progress through an element’s visibility in a scrollport. web.dev’s October 2026 platform report identifies scroll-driven animations as Newly available after Firefox 159 joined the existing Chrome and Safari implementations. [16]

The scrollable panel below has a sticky progress bar. Its transform runs from zero to one on scroll(nearest block), so it follows the panel rather than the whole page. Resetting animation-timeline after the animation shorthand matters: the shorthand resets timeline-related values. Keyboard users can focus the region and scroll it normally. [16] [3]

Try the CSS, compare the JavaScript
scroll.css
.scroller {
  height: 340px;
  overflow: auto;
  position: relative;
  border: 1px solid #93c5fd;
  background: white;
  border-radius: 6px;
}
.scroller article {
  padding: 12px 20px;
}
.progress {
  display: none;
  position: sticky;
  top: 0;
  height: 5px;
  background: #1d4ed8;
  transform-origin: left;
  z-index: 1;
}
@supports (animation-timeline: scroll()) {
  .progress {
    display: block;
    animation: progress linear both;
    animation-timeline: scroll(nearest block);
  }
}
@keyframes progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

6. Add restrained variation with random() and if()

random() can select a time, angle or length inside a bounded range. In this example it varies the lift and duration of decorative dots, then runs only two passes after the reader opts in. Random values are cached according to their sharing rules; writing random() is not a request for fresh noise on every animation frame. A custom property containing the function is token substitution, not necessarily a single frozen numeric result shared by every consumer. [5]

Use a named random key and the appropriate sharing scope when two properties must share a random base. For repeated or reproducible states, keep explicit values instead of expecting random() to behave as a seeded application-state system. Do not randomize meaningful data, reading order or text contrast. [5]

if() chooses a value using a style, media or support condition. The demo uses the media branch to select an 800ms duration below 480px; otherwise it keeps the per-dot duration. It still has an ordinary fallback and an independent reduced-motion rule. if() does not run arbitrary JavaScript expressions, fetch data or replace application state. Its semicolon-separated branches are not Sass if() syntax. [17] [3]

Try the CSS, compare the JavaScript
random.css
.dots {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 90px;
  flex-wrap: wrap;
}
.dots i {
  display: block;
  width: 24px;
  height: 24px;
  background: #0284c7;
  border-radius: 50%;
  --lift: -12px;
  --time: 1200ms;
}
@supports (animation-duration: random(800ms, 1600ms)) {
  .dots i {
    --lift: random(-24px, -8px);
    --time: random(800ms, 1600ms);
  }
  #play:checked ~ .stage .dots i {
    animation: drift var(--time) ease-in-out 2 alternate;
  }
}
@keyframes drift {
  to {
    transform: translateY(var(--lift));
  }
}
@supports (animation-duration: if(media(width < 480px): 800ms;else: 1200ms)) {
  #play:checked ~ .stage .dots i {
    animation-duration: if(media(width < 480px): 800ms;else: var(--time));
  }
}

One more useful function: linear() easing

linear(), the function, is different from the linear timing keyword. It interpolates between supplied progress points, which can approximate an overshoot or spring-like curve without shipping a spring solver. It is an established tool, not a new 2026 release. A sampled curve also does not behave like a physical spring that reacts continuously to new forces or a dragged pointer. [9]

example.css
.card {
  transition: transform 420ms linear(0, 0.8 55%, 1.06 75%, 1);
}
.card:is(:hover, :focus-visible) {
  transform: translateY(-4px);
}
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
}

What the sandbox browsers actually supported

I tested the fixtures in Chromium 159.0.8154.6, Firefox 159.0 and a WebKit build with a Safari 27.2 user-agent. These are automation engine builds, not a certification of the current retail browser releases or every mobile device. The Firefox snapshot is especially useful: it supports the sibling functions, typed attr() and scroll timelines, but not random(), if() or intrinsic-size interpolation. That does not contradict a later November Baseline milestone for random(); an installed build can lag the newest interoperable set. [3] [5]

All six demos were exercised in those three engines and at a 480px Chromium viewport. The unsupported Firefox enhancements fell back without removing content. A separate reduced-motion pass found no running animations in any demo. The checks confirmed no horizontal document overflow, the 72% meter endpoint and the scroll indicator’s end state; a tiny Firefox transform rounding difference was evaluated with a 0.001 tolerance. [3]

Observed syntax support in this sandbox6 rows
Scroll horizontally to see all columns
Observed syntax support in this sandbox
FeatureChromium 159Firefox 159WebKit build
sibling-index() / sibling-count()YesYesYes
Typed attr() / type()YesYesYes
scroll() timeline / linear() easingYesYesYes
random()YesNoYes
if()YesNoYes
interpolate-size / calc-size()YesNoYes

The performance experiment: fair JavaScript, same output

For the first pair, I made the same 120-card page twice. The CSS version uses sibling-index() for an 8ms stagger. The JavaScript version calls Element.animate() once per card with the same 600ms duration, delay, easing, opacity and transform keyframes. Both use native browser animation machinery. At a shared animation time of 400ms, all 120 computed opacity and transform states matched exactly. The live five-card demo uses a slower 80ms stagger for readability; it is not the 120-card stress fixture. [3]

For the second pair, the same reading panel and progress bar use either a CSS scroll timeline or a passive scroll listener coalesced through requestAnimationFrame. Both finish at the same scale after a controlled 1.2-second scroll. This is a small modern handler, not an intentionally wasteful loop that forces layout for every item. [3]

The machine was an Apple M5 Max on macOS. Chromium ran at 1560 × 900 CSS pixels, DPR 1, with 4× CPU throttling, 80ms network latency and 1,600 kbit/s download / 768 kbit/s upload limits. Each side used a fresh cold browser context. One warm-up pair was excluded, then six stagger pairs and five scroll pairs ran in alternating CSS/JavaScript order. The local HTTP/1.0 server did not compress responses. [3]

The tables report sample medians and ranges. These are bounded lab observations, not field Core Web Vitals or statistically proven population effects. Trace event durations are wall-time categories; they are not an additive accounting of exclusive CPU. Instrumentation was present on both sides. I attributed application compile/evaluate events to the fixture script URLs rather than pretending every observed browser script belonged to the page. INP was not observed and is not reported as zero. [3]

Download and parse: less JavaScript, small net savings

The stagger implementation replaces 292 raw bytes of JavaScript with 265 bytes of CSS. Its JavaScript file compresses to 229 bytes in an offline gzip check; the replacement CSS compresses to 196. The complete observed response bodies were 5,570 bytes versus 5,595 bytes. Both versions made three requests: document, shared stylesheet and one implementation file. “One less script” did not mean “one less request” in this fixture. [3]

CSS removes the application script’s compilation and initialization in this pair, but the removed script is tiny. A 250ms versus 252ms median paint milestone, with overlapping ranges, is not evidence of a meaningful loading-speed victory. CSS also has to be downloaded and parsed. Removing an existing animation dependency could save much more; this experiment does not measure that scenario. [3]

Load and parse observations: stagger pair8 rows
Scroll horizontally to see all columns
Load and parse observations: stagger pair
MetricCSS median [range]JavaScript median [range]
Transferred response-body bytes5,570 [5,570–5,570]5,595 [5,595–5,595]
HTML ParseHTML duration (ms)0.74 [0.49–1.05]0.78 [0.27–1.34]
Stylesheet parse duration (ms)0.21 [0.07–0.76]0.05 [0.04–0.46]
Application JS compile event (ms)0.00 [0.00–0.00]0.02 [0.02–0.31]
Application JS EvaluateScript (ms)0.00 [0.00–0.00]6.18 [5.61–6.48]
FCP / LCP (ms)250 / 250 [244–252]252 / 252 [236–256]
CLS00
INPNot observedNot observed
Animation implementation files: JavaScript removed, CSS added BAR

Raw implementation-file bodies only. Shared CSS and HTML excluded; no framework or library in either variant. Gzip figures are separate offline size calculations, not transferred bytes.

View chart data
Animation implementation files: JavaScript removed, CSS added
ImplementationJavaScript bytesCSS bytes
Stagger · CSS0265
Stagger · JavaScript2920
Scroll · CSS0167
Scroll · JavaScript3780

Rendering: the browser still has work to do

The 120-card CSS case recorded more style-update time in this run: 63.78ms median versus 54.03ms. Layout medians were 6.65ms versus 7.15ms; paint medians were 4.59ms versus 4.57ms. Both had a median of one layout event and 242 Paint trace events. Those counts describe this document and capture interval, not “242 rendered frames.” [3]

The CSS scroll timeline removes the fixture’s application scroll callbacks, which is a real simplification. It did not erase style calculation or paint, and its style-update median was again higher in this sample. Both scroll variants recorded one layout and six Paint events per sample. Small timings, variable initialization costs and overlapping ranges argue against a universal speed multiplier. [3]

The property and workload matter. A transform/opacity effect can be eligible for compositor processing in either native CSS animation or the Web Animations API; promotion is not guaranteed by the language alone. Height animation still changes geometry. Text counters still need their visible output updated. MDN’s comparison also cautions that CSS and JavaScript animation performance can be close. “Delete code the browser no longer needs you to maintain” is a stronger claim here than “CSS is always faster.” [12] [13] [3]

Rendering and scroll work9 rows
Scroll horizontally to see all columns
Rendering and scroll work
MetricCSS median [range]JavaScript median [range]
Stagger: style update (ms)63.78 [61.00–67.25]54.03 [49.54–62.19]
Stagger: layout (ms)6.65 [5.94–7.58]7.15 [6.28–8.07]
Stagger: paint (ms)4.59 [3.91–6.62]4.57 [2.81–7.34]
Scroll: application callback duration (ms)0.00 [0.00–0.00]5.53 [3.16–7.33]
Scroll: style update (ms)20.94 [17.88–25.33]17.48 [14.63–19.95]
Scroll: layout (ms)5.71 [4.64–5.88]5.33 [5.05–5.64]
Scroll: paint (ms)1.66 [1.27–2.03]1.16 [0.59–1.52]
Scroll: response-body bytes5,9796,188
Scroll: FCP / LCP (ms)232 / 232 [232–240]240 / 240 [224–240]
Stagger pair: observed main-thread rendering categories BAR

Medians of six samples per side, 4× CPU throttle. Categories are trace observations, not exclusive/additive CPU budgets. The CSS version did not win every category.

View chart data
Stagger pair: observed main-thread rendering categories
Trace categoryCSSNative JavaScript
HTML parse0.74450.778
Style update63.782554.029
Layout6.6547.148
Paint4.59054.5745

Use the platform where the relationship belongs

For a real site, start with visible content and a usable control. Put order-dependent items under one parent. Feature-test the exact declaration, not a custom property that accepts almost any token stream. Keep fallback values outside the enhancement block. Respect prefers-reduced-motion before choosing elaborate easing or randomness. Give readers a way to stop continuous motion; these demos are opt-in and finite. [11] [1] [17] [3]

Use JavaScript when animation follows application events, pointer physics, interruption rules or a multi-step workflow that CSS would express awkwardly. The modern native APIs remain good tools. The CSS advantage is strongest when the input already lives in the DOM, an attribute, a media condition or a scroll position—and the browser can derive the relationship itself. [11] [17] [16] [12]

The article’s charts and site interface can use JavaScript. Each embedded animation is a separate script-free HTML/CSS document, sandboxed so it cannot run scripts. The performance fixtures exclude the WordPress theme, chart runtime and embedding frames. The downloadable lab contains the demos, both benchmark implementations, raw numeric samples, support probes and method notes so you can inspect the same experiment rather than rely on a screenshot. [3]

Download the CSS Animation Lab: runnable examples, comparison fixtures and raw numeric results (ZIP)

INDEX

References & Works Cited

17 SOURCES
  1. Jeremy Wagner (2026-9-28). August 2026 Baseline monthly digest.

    https://web.dev/blog/baseline-digest-aug-2026
    Documentation Accessed: 2026-12-01
  2. MDN contributors (n.d.). type() CSS function.

    https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/type
    Documentation Accessed: 2026-12-01
  3. MDN contributors (n.d.). fit-content() CSS function.

    https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/fit-content_function
    Documentation Accessed: 2026-12-01
  4. MDN contributors (n.d.). calc-size() CSS function.

    https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/calc-size
    Documentation Accessed: 2026-12-01
  5. Rachel Andrew (2026-10-29). New to the web platform in October.

    https://web.dev/blog/web-platform-10-2026
    Documentation Accessed: 2026-12-01