CSS rules have two main parts, a selector and one or more declarations

Selectors are used to declare which of the markup elements a style applies to.

The declarations that appear in the block that follows the selector may be applied to all elements of a specific type, or only those elements that match a certain attribute. You will learn more about selectors in next chapter.

Each declaration consists of a property and a value. The property is the style attribute you want to change; they could be color or border etc. Each property has a value, for example color property can have value either blue or #0000FF etc.

h1 {color:blue; text-align:center;}
h1 {
    color: blue;
    text-align: center;

In the example above h1 is a selector, color and text-align are properties and given blue and center are the corresponding values of these properties.

Categories: CSS