# 12. XHTML Core Attributes Module

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) |

## 12.1. Core Attribute Collection

class = NMTOKENS
  This attribute assigns one or more class names to an element; the element may be said to belong to these classes. A class name may be shared by several element instances.

  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.

id = ID
  The @id attribute assigns an identifier to an element. The value of this attribute must be unique within a document. This attribute MUST NOT be specified on an element in conjunction with the @xml:id attribute.

  The @id attribute has several roles in XHTML:

  - As a style sheet selector.
  - As a target anchor for hypertext links.
  - As the name of a declared object element.
  - For general purpose processing by user agents (e.g. for identifying fields when extracting data from XHTML pages into a database, translating XHTML documents into other formats, etc.).

  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>

xml:id = ID
  The @xml:id attribute assigns an identifier to an element. The value of this attribute must be unique within a document. This attribute MUST NOT be specified on an element in conjunction with the @id attribute.

layout = `irrelevant*|relevant`
  This attribute allows authors to indicate whether the whitespace within an element is relevant to the meaning of the content or not; for instance, visual user agents could display the whitespace. The default is that it is irrelevant. Some elements, notably pre override this default. See whitespace handling in the section on XHTML Family User Agent Conformance for more information.

  Example

      <p class="poem" layout="relevant">
      (with wee ears and see?
      tail frisks)
                    (gonE)
      </p>

title = Text
  This attribute defines meta-information about the element on which it is set.

  Example

      <a href="Jakob.html" title="Author biography">Jakob Nielsen</a>'s
      Alertbox for January 11, 1998

Implementation: RELAX NG, XML Schema