Browser rendering: outlines, SVG animation, length units

Firefox rounds outlines first

Outlines have stayed rectangular in every browser since rounded borders became possible through border-radius, and the request to make the outline follow the border curve has sat in Mozilla, WebKit, and Chromium trackers for over a decade. The CSS UI specification has called for it since 2015:

The parts of the outline are not required to be rectangular. To the extent that the outline follows the border edge, it should follow the border-radius curve.

Firefox is set to change this within a few weeks, becoming the first browser whose outlines automatically match the border shape — including the default focus outline on buttons.

Three sets of round yellow buttons, comparing how Chrome, Firefox, and Safari handle outlines.

Chromium's equivalent request is Issue #81556 (sign-in required to star it).

Chrome moves SVG animation onto the GPU

Previously, animating an SVG element with CSS in Chromium-based browsers forced a repaint every frame, typically 60 times per second. The latest Chrome enables hardware acceleration for SVG animations, shifting that work to the GPU instead of the main thread, which removes the repaint cost that affected animation smoothness and overall page performance.

Side by side comparison of the Performance tab in Chrome DevTools.
In this example, the SVG circle is continuously faded in and out via a CSS animation (see code)

Firefox already had equivalent behavior. The change makes GPU-accelerated SVG animation the default across Chromium browsers, which keeps animations in accessible, progressively enhanced SVG rather than Canvas:

Hooray for more screen reader-accessible, progressively enhanced SVG animations and less Canvas.

Why CSS cannot express real physical lengths

CSS defines six physical units, among them in and cm, each fixed against the canonical pixel: 1in always equals exactly 96px. On most modern displays that computed length does not match an actual inch.

The CSS Working Group's FAQ now explains why true physical units are impossible: the browser cannot always know a display's exact size and resolution — projectors being the obvious case. For sites that need accurate real-world measurements, the Working Group recommends per-device calibration:

Have a calibration page, where you ask the user to measure the distance between two lines that are some CSS distance apart (say, 10cm), and input the value they get. Use this to find the scaling factor necessary for that screen (CSS length divided by user-provided length).

The resulting factor can live in a custom property and be applied when computing accurate CSS lengths.

html {
  --unit-scale: 1.428;
}

.box {
  /* 5 real-world centimeters */
  width: calc(5cm * var(--unit-scale, 1));
}

Accessibility and CSS semantics

An accessible NYT crossword

The NYT Open team documented accessibility work across the New York Times site: semantic HTML such as <article> and <nav>, stronger contrast on key components like login and registration, and skip-to-content links that account for the paywall.

The Games team additionally made the daily crossword usable with a keyboard and screen readers. The puzzle is built as a grid of SVG <rect> elements, and as the user moves through it the active square's aria-label is updated on the fly to supply context.

Screenshot of the crossword game with an open screen reader dialog announcing what is on the screen.
The screen reader announces the clue, the number of letters in the solution, and the position of the selected square

The mini crossword requires no account if you want to try it with the keyboard.

When var() resolves during inheritance

A quiz shared by Yuan Chuan hinges on whether a CSS variable is resolved before or after inheritance. The example leaves two readings of the footer paragraph's color:

  • The declared custom property values inherit down to the paragraph, and color then resolves to brown.
  • --text-color resolves to black right on the <html> element, and that resolved value is what the paragraph inherits for color.
html {
  --text-color: var(--main-color, black);
}

footer {
  --main-color: brown;
}

p {
  color: var(--text-color);
}
Two CSS rulesets, one as Option A and the other as Option B, both showing how variables are inherited and resolved between elements.

The second reading is correct — the color is black. Custom properties are resolved before their values are inherited: --text-color falls back to black because --main-color is not defined on <html>. The CSS Variables module states the rule:

It is important to note that custom properties resolve any var() functions in their values at computed-value time, which occurs before the value is inherited.