CSS Syntax

CSS Tutorial

CSS Syntax (Short Explanation)

A CSS rule has 3 main parts:

selector {
property: value;
}

Selector → Which HTML element to style

Property → What you want to change (color, font-size, margin…)

Value → The setting for that property

Each declaration ends with a semicolon (;).


📌 Example

p {
color: red;
font-size: 20px;
}

✔ Meaning:

  • This targets all <p> (paragraph) elements

  • Makes text red

  • Sets font size to 20px

You may also like...