When a CSS feature gets a Baseline badge, it's tempting to drop it into production and delete your old JS. Reality is trickier. Baseline Newly Available means recent Chromium, Firefox, and Safari all support it, yet older devices still have gaps. Here are four modern CSS techniques and the catches hiding in each.
CSS timeline-scope: one scroll driving multiple carousels
Sometimes you scroll a list of cars while a spec card glides in sync beside it. Previously, that meant scroll listeners and requestAnimationFrame. Now scroll-driven animations tie @keyframes to scroll progress instead of seconds.
Until recently, only an element and its descendants could see a scroll timeline. timeline-scope (Baseline 2026 since October: Chrome/Edge 116+, Safari 26+, Firefox 159+) lifts that limit—declare the name on a shared ancestor, and a sibling DOM branch can hook into it:
/* Shared parent exposes the timeline to all descendants */
.carousels { timeline-scope: --carousel-scroll; }
/* Primary carousel: horizontal scroll + timeline source */
.cp {
overflow-x: auto;
scroll-snap-type: x mandatory;
scroll-timeline: --carousel-scroll x;
}
.cp-slide { scroll-snap-align: center; }
/* Secondary carousel: clip overflow and scrub slides */
.cs { overflow: clip; }
@keyframes cs-scroll {
to {
/* Pass slide count via custom property instead of sibling-count() */
transform: translateX(calc(-100% * (var(--slides, 3) - 1)));
}
}
.cs-slide {
animation: cs-scroll linear forwards;
animation-timeline: --carousel-scroll;
}
Scroll .cp, and .cs tracks right along. The catch is computing the offset: the original walkthrough uses sibling-count(), which isn't Baseline yet. Without swapping in --slides, the second strip stalls in some browsers—treat the pairing as progressive enhancement for now.
Should you type every CSS variable with @property?
To a browser, normal CSS custom properties are opaque strings, so animating a gradient angle snaps instead of gliding. @property (Baseline since July 2024: Chrome/Edge 85+, Safari 16.4+, Firefox 128+) registers a syntax, inherits flag, and initial-value so the engine can type-check and smoothly interpolate it:
/* Register typed custom properties at the top of the stylesheet */
@property --accent-angle {
syntax: "<angle>";
inherits: true;
initial-value: 0deg;
}
.card-border {
background: linear-gradient(var(--accent-angle), #4f46e5, #06b6d4);
transition: --accent-angle 0.4s ease;
}
.card-border:hover { --accent-angle: 180deg; }
Don't wrap every variable in @property, though. inherits: false breaks normal cascade expectations (keep true by default, disabling inheritance only for fast-changing numbers). Mandatory initial-value also overrides var(--x, fallback) behavior, and registrations are global and rigid. Type single-type values (<color>, <length>, <number>, <angle>) you actually animate, and leave loose switches untyped.
The light-dark() trap: why missing fallbacks break colors in older browsers
light-dark() (Baseline since May 2024: Chrome/Edge 123+, Firefox 120+, Safari 17.5+) replaces repetitive @media (prefers-color-scheme: dark) blocks. Set color-scheme: light dark on :root and pass both colors. Older browsers, however, discard the entire light-dark() declaration—falling back to browser defaults unless you cascade a backup color first:
:root { color-scheme: light dark; }
body {
/* Fallback colors for older browsers */
color: black;
color: light-dark(black, white);
background-color: white;
background-color: light-dark(white, black);
}
Don't expect huge file-size savings either. Benchmarks on the CSS-Tricks stylesheet showed modest differences vs prefers-color-scheme: 169,948 vs 182,210 bytes minified (+7.2%), 30,215 vs 31,422 gzipped (+4.0%), and 337 bytes in Brotli (24,933 vs 25,270, or 1.4%). The real win is cleaner code—and a fallback line costs almost nothing.
Style queries instead of modifier classes: conditional styling by custom property
When a card sits roomy in a feed yet compact in a sidebar, teams usually reach for .card--compact or .sidebar .card. Container style queries (@container style(...)) in Baseline 2026 (Interop 2026: Chrome/Edge 111+, Safari 18.0+, Firefox 151+) handle this cleanly. Every element is already a style container without container-type: an ancestor sets a variable, and the card adapts on its own:
/* Layout flags the sidebar on wide screens */
@media (width > 700px) {
.layout {
grid-template-columns: 1fr 18rem;
.sidebar { --card-density: compact; }
}
}
/* Card adapts automatically to its ancestor's variable */
.card {
display: grid;
gap: 0.75rem;
@container style(--card-density: compact) {
padding: 0.5rem;
gap: 0.5rem;
}
}
The same pattern works for grids: when .split sets --overflow-grid-direction: row inside @container main (width > 40rem), a child .overflow-grid switches to grid-template-columns: 1fr and max-block-size: 50vb, turning horizontal scroll vertical.
The #1 beginner mistake: an element cannot query a variable set on itself. Put --card-layout on .card and query it on .card, and nothing matches—the variable must live on an ancestor. Style queries also only see custom properties, not regular properties like style(display: flex). Self-querying will arrive with CSS if() (for single properties only), while local variants like .button--accent or .toast[data-type="error"] remain simpler with BEM or data attributes.



