class Attribute


 

Where to use the class Attribute

class is a Common Attribute from the Core Attribute Collection and is of Type NMTOKENS.

It may be used on most elements in the Element Index - all except: base, head, html, meta, param, script, style, title.


Description

A class attribute may be given to almost any element in order to assign one or more class names to the element. Unlike the case of the id attribute, the same class may be given to more than one element. In fact, the main use of the class attribute is to group elements so that a single CSS rule may be applied to the entire group.

Important notes about class attributes:
  1. Multiple class names should be separated by white-space.
  2. Each class name in the list should follow the format specified for the NMTOKEN Attribute Type.
  3. If compatibility is desired with CSS identifiers, the W3C's *CSS 2.1 - Characters and Case information should be noted.

See also the id attribute.


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 16 May 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Attribute Index (XHTML 1.1) > class Attribute (XHTML 1.1)