Contents
This section is normative.
This module defines the Core attribute collection.
Attribute | Notes |
---|---|
@class (NMTOKENS) | |
@id (ID) | |
@xml:id (ID) | |
@layout (irrelevant*|relevant) | |
@title (Text) |
The @class attribute can be used for different purposes in XHTML, for instance as a style sheet selector (when an author wishes to assign style information to a set of elements), and for general purpose processing by user agents.
For instance in the following example, the p element is used in conjunction with the @class attribute to identify a particular type of paragraph.
Example
<p class="note"> These programs are only available if you have purchased the advanced professional suite. </p>
Style sheet rules can then be used to render the paragraph appropriately, for instance by putting a border around it, giving it a different background color, or where necessary by not displaying it at all.
It is good style to use names that represent the purpose of the element rather than the visual presentation to be used. For instance don't use class="red"
, but rather class="urgent"
, or similar.
The @id attribute has several roles in XHTML:
As an example, the following headings are distinguished by their @id values:
Example
<h id="introduction">Introduction</h> <p>...</p> <h id="events">The Events Module</h> <p>...</p>
Example
<p class="poem" layout="relevant"> (with wee ears and see? tail frisks) (gonE) </p>
Example
<a href="Jakob.html" title="Author biography">Jakob Nielsen</a>'s Alertbox for January 11, 1998
Implementation: RELAX NG, XML Schema