Introduction
CSS Syntax
A CSS file is a list of rules. Each rule has a selector and a declaration block.
Syntax:
selector {
property: value;
property: value;
}| Part | Example | Meaning |
|---|---|---|
| Selector | p | Which elements to style |
| Property | color | What to change |
| Value | red | How to change it |
| Declaration | color: red; | One property + value, ending with a semicolon |
p {
color: #333;
font-size: 18px;
line-height: 1.6;
}Comments
/* This is a CSS comment */
p { color: gray; } /* comments can go at the end of a line too */