Search⌘ K
AI Features

Introduction to CSS Variables

Explore how CSS variables, also known as custom properties, allow you to reuse values like colors in your stylesheets. Understand how they keep your CSS organized and make updating design elements more efficient. This lesson guides you through creating and applying CSS variables to simplify large-scale style changes.

A CSS variable is simply a value that you want to reuse, again and again, in your layout.

CSS variables are formally known as custom properties.

Why CSS variables

CSS variables give us a way to keep our code nicely organized and easy to update. For example, let’s say that we want to update the font color on certain parts of our page from gray to darkslategray. Let’s also ...