Course offer · HLD · LLD · System Design at ₹799 until 30 Nov (not interview packs)

CSS Studio

Interactive Learning

On this tool

Variables inherit. A child that sets --primary changes every descendant that reads var(--primary) unless you reset it.

Variables

CSS Variables & Theming

Custom properties turn one-off colors into a theme system. Set --bg, --surface, --text, --primary, and --radius on :root, flip light and dark, and see cards and buttons follow. Then override tokens inside a scoped component to learn cascade for variables. Copy the generated :root block into your design system and keep component overrides rare and intentional.

What people get wrong

Variables inherit. A child that sets --primary changes every descendant that reads var(--primary) unless you reset it.

Do CSS variables work in media queries?
You can redefine custom properties inside a media query or a .dark class. Components that already use var(--token) pick up the new values automatically.

Theme

:root tokens

16px

Scoped override

Generated CSS
From the controls
Loading editor…

Theme card

Uses var(--surface), var(--text), var(--primary).

Scoped card

Overrides --primary inside this component only.