What are CSS variables?

CSS variables (custom properties) store a value that you can reuse. You define them with --name and read them with var().

:root { --main-color: #0073aa; }

a { color: var(--main-color); }
button { background: var(--main-color); }

Change the variable once and every place that uses it changes. They are also easy to change with JavaScript, for themes. See CSS Variables.


Learn more about the similar topics:
Tutorials
CSS Introduction
CSS Inclusion
CSS Syntax
CSS Comments
CSS Variables
List of common CSS Properties
Exercises & Assignments
No Content Found.
Interview Questions & Answers
Explain the various ways to apply CSS styles to a web page
What are the advantages of CSS?
What is CSS?
What is the difference between link and @import in CSS?
What are CSS variables?
What is a CSS reset?