New Element Attributes

Practically every existing element has one or more new attributes in HTML 4.0. Many of these new attributes are applied to every element due to HTML 4.0’s focus on internationalization, accessibility, style sheets, and scripting. Table 7.3 lists the common attributes that have been added to most elements that can act as content containers (that is, they have start and end tags). Element-specific additions are not shown here, but are covered in full in Chapter 8.

Table 7-3. New HTML 4.0 Attributes Shared by Most Elements

Attribute

Description

CLASS

Group identifier (selector) for applying a style rule

DIR

Text direction of the element’s content

ID

Unique identifier (selector) for applying a style rule

LANG

Human language used in the element’s content

STYLE

Inline style sheet rule

TITLE

Short description of the element

onClick

Event handler for click events

onDblClick

Event handler for double-click events

onKeyDown

Event handler for keyboard key down events

onKeyPress

Event handler for keyboard key press (down and up) events

onKeyUp

Event handler for keyboard key up events

onMouseDown

Event handler for mouse down events

onMouseMove

Event handler for mouse movement inside the element

onMouseOut

Event handler for mouse movement out of the element

onMouseOver

Event handler for mouse movement into the element

onMouseUp

Event handler for mouse up events

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.