CSS Rules

CSS rules are statements that define the style of (X)HTML elements or a group of (X)HTML elements. The syntax of CSS rules are as follows:

selector { property: value; property: value; property: value; }

Each "property: value" pair is called a declaration. Multiple declarations are seperated by semi-colons. Each group of declarations must be enclosed within curly braces. The selector defines which elements the rule is applied to.

The code below is an example of CSS rules.

h1 { color: red; } p { color: blue; }

The CSS rules specify that all level 1 heading text should be red and that all paragraph text should be blue.

CSS Comment Tags

All text within comment tags in CSS are ignored by web browsers and begin with "/*" and end with "*/".

The code below shows you how to implement comments in your CSS code.

/* This comment will be ignored by the web browser */ p { color: red; }

Web Hosting Resources

Free Website Templates