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;
}
Selector
Property
Value
Summary
- CSS rule = selector + declaration
- Declaration = property + value
- Used to style HTML elements