HTML 4 - Common Attributes

This section covers the three categories of common attributes--those which show up in almost every tag. It gets extremely repetitive to list these same attributes over and over again, so they have been abbreviated into three categories: %il8n, %coreattrs, and %events. The abbreviations are those used by the WWC in their HTML specification.


Attributes for Internationalization - %i18n

  lang=
Specifies language.
This attribute defines the language of the element.

  dir=
  • "ltr"
Specifies left-to-right direction.
  • "rtl"
Specifies right-to-left direction.
This attribute tells the browser the direction of characters with weak (punctuation) and neutral (spacing) directionality. When used in the TABLE tag, it tells the browser which side of the table to place the first column.

Attributes for Identification and Style Sheets - %coreattrs

  id=
Specifies the id name, which must be unique in the document. No other name, id, or class may have the same value.
This attribute gives the element its own ID (and so must be unique to the particular instance) for identification purposes. Scripts and style sheets may refer to an element by ID and links may use the ID like an anchor name.

  class=
  • "__"
    [class name list]
Specifies the classes to which the element belongs with a space-separated list of class names.
This attribute classifies the element by defining a list of classes to which it belongs. Class names can be used by style sheets to add formatting to all elements in the class.

  style=
  • "__"
    [style sheet data]
Gives rendering instructions as a style sheet in the document's default style sheet language.
This attribute defines a style sheet for the element.
Setting the default style sheet language

  title=
Gives the title.
This attribute gives a title to its element, just as the <TITLE> element gives a title for the document.

Attributes for Use with Scripts - %events

  onclick=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a mouse clicks on the element.
You must specify a default scripting language!

  ondblclick=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a mouse double-clicks on the element.
You must specify a default scripting language!

  onmousedown=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a mouse button is pressed while the cursor is over the element.
You must specify a default scripting language!

  onmouseup=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a mouse button that was pressed over the element was released.
You must specify a default scripting language!

  onmouseover=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a cursor is over the element.
You must specify a default scripting language!

  onmousemove=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a cursor moves over the element.
You must specify a default scripting language!

  onmouseout=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when a cursor that was over the element moves off the element.
You must specify a default scripting language!

  onkeypress=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script if a key was pressed and released while the element was selected.
You must specify a default scripting language!

  onkeydown=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script if a key was pressed down while the element was selected.
You must specify a default scripting language!

  onkeyup=
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script if a key that was pressed is released while the element is selected.
You must specify a default scripting language!