"class=" attribute



Note: If your browser supports CSS1, the "class=" attributes below will be crimson.
Note: There are two definitions for this attribute.

HTML 3.0 — Expired

     This is a space separated list of SGML NAME tokens and is used to subclass tag names. By convention, the class names are interpreted hierarchially, with the most general class on the left and the most specific on the right, where classes are separated by a period. the Class attribute is most commonly used to attach a different style to some element, but it is recommended that, where practical, class names should be picked on the basis of the element's semantics, as this will permit other uses, such as restricting search through documents by matching on element class names. The conventions for choosing class names are outside the scope of this specification.

Cascading Style Sheets - Level 1 (CSS1) & HTML 4.0

Class= attribute

     In CSS1 there must be a method of attaching specific format to where that format will be used. There are three such vehicles:

     Only one class can be used per selector.

     The class name used can be any combination of alphanumeric characters. The maximum number of characters is unknown at this time but try a maximum of 8 until more specific information is available.

     A class when it is defined is delimited by a leading period, separating it from the selector:

<head><style type="text/css">H1.first { format stuff here} </style></head>
     When the class is used, it is used as a full attribute to the tag:
<H1 class="first">

Pseudo-Classes

     There are a few specific class names that are reserved for page specific functions. These are called pseudo-classes. At present, there are only three pseudo-classes and they are used exclusively with the <a> tag.

     This allows the modification of how links are presented in a page. This is similar to <body alink= link= vlink=>. The difference is that the 'alink=', 'link=' and 'vlink=' attributes modify the colours for the entire page. The pseudo-classes allow changes based on the specific situation of use.

     Consider this link. When you hold down the mouse button on it, it will turn yellow. After clicking on it, it would turn red if there were a real page behind it.

     The CSS1 standard stipulates that the selector need not be included when defining these pseudo-classes. Since pseudo-classes are only used with the anchor tag, they are sufficiently unique as not to need to anchor selector. However, if you view the source, the anchor selector is there. MSIE 4.0 has not adhered to this part of the standard, yet.

Netscape

Netscape has defined "class=" in two ways.

Netscape 3.0 defines it as follows:
CLASS="type" identifies and specifies the characteristics of the element.

Netscape 4.0 defines it as follows:
CLASS="classType" specifes to which class of style an element belongs.