Some CSS Vocabulary
In order to learn CSS effectively, it's helpful to have a vocabulary to describe each part of a CSS style declaration.
CSS Selector
The first thing we encounter in a CSS style declaration is the selector. This can be an XHTML tag element, like body or p. The selector should be followed by a space and then an open curly-brace, {. We have a section later in the CSS chapter dedicated to more advanced selectors, where we'll see CSS's ability to control your pages based on context and user-action.
CSS Property
Once a selector has been declared, we need to declare one or more properties, which are simply the CSS names of visual attributes. Examples include color (for text color), margin, or even cursor, which can change what a user's cursor looks like when it hovers over a given page element. CSS properties must be follwed by a colon, : and a space.
CSS Value(s)
All properties must be assigned values, such as colors and measurements. Some CSS properties allow or even require multiple values. For example, when declaring margins on a selector, we use the TRouBLe or TRBL method: top, right, bottom left. Once the value or values have been assigned, we terminate that line of the style declaration with a semi-colon, ;.
The Complete Style Declaration
So, when all of this is put together, this is what we see (I've labeled everything based on what it is, instead of using actual selectors/properties/values):
selector {
property: value;
property: value1 value2 value3;
}
Updated on Mon. Feb. 27 2006 at 12:59PM