C & G web

Cascading Style Sheets

Structure of Rules and Declarations

A rule consists of two parts:

Selector - the part before the left curly brace;
Declaration - the part within the curly braces.

H1 { color: green }

The selector specifies which element is to be affected by the declaration. The declaration describes what the effect will be. In this example all H1 elements will be affected by the declaration and will be shown in green.

The above selector is based on the type of the element: it selects all elements of type H1. Because of this it is called type selector. Any HTML element type can be used as a type selector for example <P>, <I>, or <B> tags can have their styles defined.

P { color: red }
I { color: blue }
B { color: yellow }

Structure of a Declaration
A declaration has two parts separated by a colon:

Property - the part before the colon,
Value - the part after the colon.

H1 { color: red }

The property is a quality or characteristic that something possesses. In this case it is color. CSS defines over 50 properties and you can assign values to any of them.

 
<--- Previous Page Next Page --->

Previous page...

Back to Top of Page

Computeach International Ltd

Christopher Ward London Limited

Christopher Ward London Limited