Style sheet properties are divided into two parts:
The property name and the value are separated by a colon (
:). The entire property ends with a semi-colon (
Actual Example (setting the font-size property to be 24 point):
Note: A property name NEVER has any spaces in it. An individual value NEVER has any spaces in it. There MAY be a space after the colon, but it is not recommended.
The following example is acceptable:
In the above example, I have placed a space after the colon between the property name and value; this is permissible (but, again, not recommended).
The following example is WRONG:
In the above example, I have placed a space in the property name; this is illegal and will cause your CSS to break. The actual property name is
The following example is also WRONG:
In the above example, I have placed a space between the number and the type of measurement unit in the value of the property definition; this is illegal, and will cause your CSS to break. The actual value is
"24 pt" (which means something COMPLETELY different in CSS).
As you can probably already tell, CSS is MUCH more particular about syntax variations than regular HTML. You must be extremely careful with your syntax in CSS, or your CSS will fail to operate.
You will also notice that there are NO equals signs (
=) or quote marks (
"") in CSS. Although we are dealing with CSS properties for tags which have some parallels in HTML attribute syntax, the actual syntax constructs are completely different. CSS IS NOT HTML!
Copyright © 2001 Michael Masumoto. All Rights Reserved.