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
From the course: CSS Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
CSS specifications and the W3C2m 35s
-
(Locked)
CSS syntax and terminology3m 29s
-
(Locked)
CSS data types2m 42s
-
(Locked)
Type and universal selectors3m 2s
-
(Locked)
ID selectors1m 53s
-
(Locked)
Class selectors3m 39s
-
(Locked)
Combinators and selector lists3m 3s
-
(Locked)
Pseudo-classes and pseudo-elements3m 22s
-
(Locked)
Inheritance, cascade, and specificity4m 55s
-
(Locked)
Custom properties4m 42s
-
(Locked)
Referencing CSS3m 28s
-
(Locked)
Project: Create a CSS file4m 32s
-
(Locked)
-
-
-
-
-
-
-
-