Add

Lorem ipsum

Lorem ipsum

A
A
A
Design

3 views

4 min

How to Create and Use CSS Variables in Webflow

Learn how to create and use CSS variables (design tokens) in Webflow for consistent, maintainable styling.

In this tutorial, Sandro, co-founder of the Gemeos Webflow agency, shows you how to create and use CSS variables (design tokens) in Webflow.

Variable typeExampleUse
Color--color-primary: #3B82F6CTAs, links, accents
Typography--font-size-body: 16pxBody text size
Spacing--spacing-md: 24pxStandard padding and gaps
Border-radius--radius-card: 12pxRounded card corners
Shadow--shadow-card: 0 2px 8px rgba(0,0,0,0.08)Drop shadows

1. Create your variables in Webflow

In the Designer, open the Variables panel (palette icon at the top left). Click + to create a new variable. Give it a name (for example, color-primary) and define its value. Variables are available for colors, typography, and spacing.

2. Apply variables in your styles

In an element's Style panel, where you usually set a color or size, click the variable icon and select your variable from the list. Every element using that variable updates automatically when you change it.

3. Create modes (dark mode, variants)

Webflow variables support modes: set alternative values for the same variables (for example, color-primary in dark mode). Activate a mode with a class or an attribute on the body.

4. Custom CSS variables via embed

For variables that aren't natively supported (complex spacing, shadows, radius), add a global CSS embed with your custom properties and use them in custom CSS or embeds on your pages.

good to know

Webflow variables are synced with the browser's standard custom CSS variables. A Webflow variable like 'color-primary' is accessible in CSS as var(--color-primary). So you can use them in your custom CSS embeds and in your JavaScript scripts via getComputedStyle(document.body).getPropertyValue('--color-primary').

Conclusion

CSS variables speed up global changes and keep everything consistent. For naming best practices: create a consistent color system.

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...