Code and data

Trace a CSS custom property through a responsive override

·

A print studio is moving a panel theme into its own stylesheet. Trace which custom property names it needs to copy and where spacing changes at the larger viewport.

CSS Variable Extractor

Trace the two ink tokens

Load the example and select Extract variables. The report shows four declarations and five references. :root declares --Ink on line 2 and --ink on line 3. These are distinct names.

Inspect the color reference on line 7. The fallback for --Ink contains var(--ink, rgb(24, 51, 74)). The inner reference has its own fallback. In the export, the comma inside rgb() stays inside that inner value.

W3C, CSS Custom Properties for Cascading Variables

Locate the spacing override

Find --gap in the declaration inventory. Its first value is 8px in :root. Its second is 12px on line 12, scoped to .panel inside @media (min-width: 48rem).

Check the padding reference on line 8. Copy both declarations when migrating the example if you need to preserve the responsive override. Keep the media condition and selector with the second declaration.

W3C, CSS Custom Properties for Cascading Variables

Check the accent reference before migrating

The report lists --Accent as reference-only in the supplied CSS. Its responsive color rule falls back to var(--Ink) if --Accent is unavailable. Search neighboring stylesheets or the page for an inherited or inline value before assuming that fallback always applies.

Download css-variables.json and look for line 13. The --Accent reference retains the full fallback text including the leading space after the comma. The nested --Ink reference records null because it has no fallback of its own.

W3C, CSS Custom Properties for Cascading Variables

Common questions

How does an empty var() fallback appear?

A comma with nothing after it has an empty fallback. The JSON report uses null only when there is no fallback comma.

Does an @property registration count as a declaration?

The report lists it separately. A registration can supply initial-value and inheritance behavior without assigning a declaration inside a style rule.

Sources

Put it into practice.

Related guides