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

selector references the HTML elements to which the style applies.

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

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.


No comments:

Post a Comment