CSS Syntax

CSS Rule Structure

A CSS rule has a selector and a declaration block.

Example:

Here we style p and h1 elements.

CSS Syntax Example
p {
    color: blue;
    font-size: 18px;
}

h1 {
    color: royalblue;
    text-align: center;
}
Try it Yourself
Selector
Property
Value

Summary