From the course: CSS Essential Training

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Custom properties

Custom properties

- [Instructor] Custom properties, also referred to as CSS variables are used to create your very own reusable CSS values. Let's say you have specific colors that will be reused throughout your website. So far, we've used keyword color values in our examples, but there are a limited number of options. For this reason, hex color values are more commonly used. They are represented by a combination of letters and numbers, so it's not as easy to recognize what color they represent. Before custom properties existed, I used to create a reference file or add comments to my projects to list the values for reference. But with custom properties, we can create our own naming system. The variable name can be anything, but they must start with two dashes. Use one dash to separate words within the name. The name is followed by a colon. Then the value and ends with the semicolon. For values like colors, using a name that describes it…

Contents