Similar to an ID selector, a class selector is used as an attribute of an HTML tag via the class attribute. Classes, like all css, can be defined in the head of an html document. When defined, a class name must start with a period. See the code for this page to see the two class rules that are already defined and what their properties are. You can use almost any word you want to name the class but it should be alpha-numeric with no spaces.
A class can be applied to any tag where its specifications are relevant. For example, specifying a font in a class rule and then applying that class to an image tag will have no effect.
In the examples below, the classes are applied to font formatting tags, which is appropriate because the classes in this case assign text formatting values such as text color, italics, and point size. In the examples below, the class attribute is being used with the <big> and the <b> tags, however in each example a different class is being applied. Check out the code:
This is really, really, really important.
This is even more important
© 2008 Dan Hitchcock Vaughan and its licensors. All rights reserved.