Gian
Gian

Reputation: 23

Is there a way to create global CSS variables?

Global CSS variables

I have multiple CSS files in my project

Project directory example

I don't want to set the variables in each CSS file, but I would like to access them from every file.

Upvotes: 0

Views: 789

Answers (2)

CodeFinity
CodeFinity

Reputation: 1350

You just need to create a globals.css file in there somewhere. Add your CSS Variables. @import that file into the others where needed.

Upvotes: 1

Ortiga
Ortiga

Reputation: 8824

You can import another CSS file from a CSS using:

@import "path/variables.css";

MSDN Documentation

Upvotes: 4

Related Questions