Monday, July 21, 2008

Useful CSS Properties

Basic Concepts

One or more selectors separated by commas. Grouping allows you to assign styles to multiple elements (selectors). All four heading tags below will be purple.

H1, H2, H3, H5 {color: purple;}

Contextual selectors

One or more selectors delimited by spaces. The example rule indicates the bold markup will be red only while enclosed in H1 tags.H1 B {color: red;}

This is red.

This is not.


Class selectors may be used as an attribute to a tag. A class selector is a string preceded by a period. Do not use the period when referencing the class. Do not begin a class name with a number, although IE4/5 let you get away with it.

.example {color: red;}

This is an example in red.

Page copy protected against web site content infringement by Copyscape
Clicky Web Analytics