Skip to content
Ben Serkan Zararsız

What the browser does for free now

Half the JavaScript in a typical interface exists because CSS could not do something in 2019. In 2026 it can. Five things I now ship with a stylesheet, each with a demo.

On this page
  1. Intro
  2. Enter from nothing
  3. Stick to the button
  4. Animate with the scroll
  5. Cut, don’t hide
  6. Fields that fit
  7. Before you delete the JavaScript

My weather map is deliberately small: one static page, no backend, no cost. Thousands of drifting lines, a timeline you can drag, and most of it is CSS. No stunt, just where the platform has quietly arrived.

For a decade, interface work meant reaching for JavaScript whenever CSS fell short: a tooltip that has to flip at the edge of the screen, an element that should fade in from nothing, a progress bar tied to scrolling. Those gaps have closed, in all major browsers. These are five things the browser now does for free, each one a dependency you no longer need to maintain.

Enter from nothing

The oldest hack in the book: show the element, wait one frame, then add the class that animates it in. Without the wait, the transition never runs, because the element went straight from not existing to its final state. Now a stylesheet can declare where an element starts the moment it appears, and the transition takes care of the rest. No timer, no double frame, no library.

This matters beyond convenience. A popover that appears abruptly answers no question about where it came from. One that eases out from its button does, and that now costs one rule.

Price

€0 to €200

Size

41, 42, 43

Eases in from its button, CSS only

Price

€0 to €200

Size

41, 42, 43

Appears from nowhere

Stick to the button

Tooltips and menus have one job: stay attached to the thing that opened them. For years that meant measuring the screen in JavaScript, flipping the position by hand and listening to every resize. Anchor positioning moves all of that into CSS. You name the anchor, say which side you prefer and list the fallbacks. The browser picks the first position that fits.

It shipped in every major engine over the past year, with Safari and Firefox completing the set. If you still carry a positioning library for one tooltip, this is the moment to retire it.

Copies a link anyone can open

Anchored, flips when it would overflow

Copies a link anyone can open

Fixed offset, clipped at the edge

Animate with the scroll

Reading progress bars, headers that shrink, images that reveal on the way in: all of them used to need a scroll listener and a bit of maths on every frame. With scroll-driven animations the timeline is the scroll itself. The animation runs off the main thread, stays smooth on a cheap phone and needs no listener at all.

Full disclosure: the thin line at the top of this page still uses a listener, because I wanted it to work in every browser today. The box below does not. Next year, the listener goes.

Scroll this box. The line at the top is an ordinary CSS animation whose timeline is the scroll position of this container.

There is no scroll listener, no requestAnimationFrame and no maths. The browser samples the animation on the compositor, which is why it stays smooth even while the main thread is busy.

The same mechanism drives headers that shrink, images that reveal as they enter the viewport, and the small details that used to need a library.

If your browser does not support scroll-driven animations yet, the line simply stays empty. Nothing breaks, which is exactly how a progressive enhancement should fail.

The progress line is driven by the scroll position of the box. No JavaScript involved.

Cut, don’t hide

To reveal an image, most interfaces animate its height. That moves everything below it on every frame and forces the browser to lay out the page again and again. Clipping does the same visually without touching layout: the element is already in place, only the visible window changes. It runs on the GPU and costs almost nothing.

The same idea gives you before-and-after sliders, tab highlights that glide without a colour flicker, and theme switches that wipe across the page. One property, many patterns. And since this year the shape can be described in responsive units instead of a fixed path.

Trail Runner 42

Lightweight, waterproof, 280 g

Drag the slider. Both cards are fully rendered; only the clip moves.

Fields that fit

Small things, finally native. A text area that grows with what you type instead of a resize script on every keystroke. Paragraphs that avoid a lonely last word because the browser balances the line breaks itself. A text colour that flips to black or white depending on the background it lands on. None of these is spectacular on its own. Together they remove a dozen helpers from a typical codebase.

Grows with the content, one CSS property

Fixed height, scrolls inside itself

Before you delete the JavaScript

A short discipline keeps this from becoming the next round of hacks:

  1. Check Baseline, not one browser. “Widely available” means two and a half years of support behind you.
  2. Keep a fallback wherever the feature changes meaning, not just polish.
  3. Respect reduced motion in CSS too. Scroll-driven and entry animations count.
  4. Measure on a cheap phone, not on your laptop.
  5. Then delete the dependency. That is the point.

Deliberately small used to be a constraint. Today the platform rewards it.

Sources

  1. web.dev: What is Baseline?
  2. WebKit: WebKit Features in Safari 26.0 (September 2025)
  3. Chrome for Developers: CSS Wrapped 2025
  4. MDN Web Docs: CSS anchor positioning