Skip to content

Design4 min read

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.

Conclusion

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

Published on May 19, 2026

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

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