Search⌘ K

How CSS rules work

Explore how CSS rules function by learning to use selectors, properties, and values to style HTML elements. Understand how to target specific elements such as headings and apply colors using proper syntax including white space and curly braces. This lesson helps you confidently write and modify simple CSS rules to style web pages.

We'll cover the following...

CSS is a fun language, and it is quite easy to pick up.

Let’s take a look at a very basic CSS rule. By “rule” I mean a piece of CSS code.

NAME_
CSS
h1 {
color: red;
}

You may not have not noticed, but this basic css rule can be broken into a few bits.



widget

The h1 selector in the rule says, select all h1 ...