XSLT Workshop: Basic CSS Crib Sheet

This is a very brief reference sheet than an exhaustive list of CSS terms: it is intended to provide you with a way to look up the information you’re most likely to need right away. For detailed information about CSS syntax, selectors, and properties, visit the W3C’s CSS tutorial pages at http://www.w3schools.com/css/.

CSS Rulesets

The components of a ruleset.

The components of a ruleset.

A CSS stylesheet is essentially a group of rulesets. Rulesets are made up of three things:

selectors
These are how you select which elements or groups of elements in your document will be affected by the style information.
properties
These identify the style properties (such as size or color) that are being controlled.
values
Each property has a specific value indicating the size, color, margin, or other style information that is being applied.

See next page for more detailed discussion of each

Selectors

A selector is the way you identify the elements or groups of elements that will be affected by your style information. A selector may be simply the name of an element, or they may take into account the nesting of the element, or a specific attribute value.

Here’s a list of the most common selectors and their syntax.

element:
h1{font-size: 125%;}
element descendant-element:
p strong{font-style: italic;}
element.class:
span.speakerName{font-weight: bold;}
element #id:
div#menu{background-color: grey;}

Properties and values

Here’s a list of common properties and their most common kinds of values. Note that some properties (especially those that govern size) can be measured in several different ways. Some of the measurements are in absolute units such as pixels; others are relative to the font size (for instance, ems), and others are relative to the surrounding text (for instance, percentages or larger or smaller).

For more detailed information on CSS colors, see http://www.w3schools.com/css/css_colornames.asp