Search⌘ K
AI Features

Styling Page Elements

Explore how to apply CSS styles to webpage elements by understanding selectors, declaration blocks, and CSS properties. Discover the difference between internal and external style sheets, and how to use them effectively to style multiple pages or specific ones. This lesson builds a foundation for managing page appearance using CSS rules.

We'll cover the following...

You can apply styles to a webpage in several ways, as you’ll see soon.


A style, often referred to as rule, is a compound expression that is built from a selector and a declaration block that contains zero, one, or more declarations.


Each declaration is a pair of a property and a value. The syntax of a rule is the following:

NAME_
CSS
selector {
property1: value1;
property2: value2;
propertyN: valueN;
}

Let’s take a look at this example:

NAME_
CSS
h1 {
color: white;
background-color: blue;
}

Here, ...