CSS Basics

CSS defines the look-and-feel of HTML elements. This is called styling.

A style is written as a rule-set which consists of a selector and a declaration block.

A selector defines which HTML elements are selected.

A declaration block lists properties, such as color or border, and their values.

Here's a visual overview of a rule-set.


Explanation

A selector references the HTML elements to which the style applies.

A declaration block consists of one or more declarations separated by semicolons.

A property is the characteristic that will be styled (e.g. color, border).

The value is the value for the property (e.g. color property can have blue as value).

Declarations end with a semicolon, and declaration blocks are surrounded by curly braces.

This entire description represents a single rule-set.