Home >>XHTML Tutorial >XHTML Attributes

XHTML Attributes

XHTML Attributes

There are a few regular XHTML/HTML attributes that are shared with all of the XHTML/HTML tags. Such attributes are briefly mentioned here –

There are some XHTML attributes which are standard and associated to all XHTML tags. The XHTML attributes can be divided in 3 types:

  • Core Attributes
  • Language Attributes
  • Microsoft Proprietary Attributes

Core Attributes

The core attribute is not valid in base, head, html, meta, param, script, style, and title elements.

Attribute Value Description
class class_rule or style_rule It definesThe class of the element.
Id id_name It defines A unique id for the element.
style style_definition It defines An inline style definition.
Title tooltip_text It defines A text to display in a mouse tip.

Language Attributes

The lang value specifies the language used with the content contained therein. The language is classified using abbreviations in the ISO uniform script, such as fr for French, en for English, etc. The www.ietf.org explains more codes and their types.

Not valid for elements in base, br, frame, frameset, hr, iframe, param, and document.

Attribute Value Description
dir ltr | rtl used to set the text direction.
lang language_code used to set the language code.

Microsoft Proprietary Attributes

Microsoft is adding those proprietary attributes for the Internet Explorer 4 and later versions.

Attribute Value Description
accesskey character Used to set a keyboard shortcut to access an element.
language String This attribute is specifies the scripting language which is used with the script bound to the element, typically through an event handler attribute. Its possible values might include JavaScript, jScript, VBS, and VBScript.
tabindex Number Used to set the tab order of an element.
contenteditable Boolean It allows users to edit content rendered in internet explorer 5.5 or greater. Its possible values are true or false.
disabled Boolean The disabled attribute makes the element appear faded and will not respond to user input. Its possible values are true or false.
hidefocus On or Off This proprietary attribute, introduced with internet explorer 5.5, hides focus on an element's content. It specifies that focus must be applied to the element using the tabindex attribute.
unselectable On or Off Used to prevent content displayed in internet explorer 5.5 from being selected.