These attributes primarily allow the attachment of rendering information
to HTML documents. They facilitate the binding or identification of an
HTML structure, so that an element (or group of elements) may be controlled
by a non-HTML mechanism (such as the DOM through Javascript or with CSS.)
This attribute category directly draws its inspiration from a
Parameter Entity category defined
in HTML 4.x called "%coreattrs". This category includes the CLASS, ID,
and STYLE attributes, but it also includes the TITLE attribute as well.
I moved global TITLE attribute to its own category called %accessibility%
along with ACCESSKEY, DISABLED and TABINDEX, where they all seem to more
appropriately belong as a group.
Description:
This attribute serves to classify the current element by assigning it one or
more category labels to which the element belongs. Such grouping mechanisms
ease in the assignment of rendering characteristics for groups of elements.
Values:
Given as a space separated list of class names consisting of alphanumeric characters.
Description:
This assigns a unique alpha-numeric identifier for referencing the current
element. No other ID attribute in the current document may share
the same identifier. IDs are used in many contexts in HTML, such as: Hyperlinks
may use this identifier to serve as a destination of a link, scripts may use
them to uniquely identify an element for some programmatic purpose, or
style sheets may use this attribute to reference the current element instance.
Values:
A string of characters - the initial character must be in the [a-zA-Z]
set, while subsequent characters can be in the [a-zA-Z0-9.-:_] set.
Description:
This attribute is a text string providing rendering information for the
current element.
Values:
Please see the description of
inline
styles[-->Index DOT Css] for more
information on how to use this attribute and its
possible
values[-->Index DOT Css].
Tips & Tricks
DTD Note: HTML 4.01 states that a NAME and ID may
exist for the same element, as long as they share the same value (this
is mainly for backwards compatibility.)
For the ID attribute, it can be used to assign CSS to elements, but it
is also key to accessing DOM activities on a per-element basis. Some
of the supported elements listed (like HEAD, META, SCRIPT, etc...)
can not have CSS applied to them, but they are DOM-accessible using
their ID attributes, so they are listed.
Browser Peculiarities
Netscape 4.x has a bug: A location in a document can be defined using the
ID attribute as well as the A NAME element. In Netscape 4.x this can be
accessed using hyperlinks from external documents, but if the hyperlink
is within the same document, the link does nothing.
Netscape 4.x and Opera 3.5+ do not allow CLASS or ID attributes to contain
underscore characters ("_".) Underscores are legal in HTML attributes
according to the HTML standards but not according to the CSS standard.
Netscape 6 Beta 1 allowed core (style sheet) attributes to be used for
ANY element, even nonsense, made-up elements. This behavior was changed
(fixed?) in 6.0 Beta 2 and above.