Skip to main content

XHTML Attributes

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

Not valid in base, head, html, meta, param, script, style, and title elements.

AttributeValueDescription
classclass_rule or style_ruleThe class of the element.
Idid_nameA unique id for the element.
stylestyle_definitionAn inline style definition.
Titletooltip_textA text to display in a mouse tip.

Language Attributes

The lang attribute specifies the language which is used for the enclosed content. It uses the ISO standard language abbreviations like fr for French, en for English, and so on.

The language attribute is not valid in base, br, frame, frameset, hr, iframe, param, and script elements.

AttributeValueDescription
dirltr | rtlSets the text direction.
langlanguage_codeSets the language code.

Microsoft Proprietary Attributes

Microsoft introduced a number of new proprietary attributes with the Internet Explorer 4 and higher versions.

accesskeycharacterSets a keyboard shortcut to access an element.
languagestringThis attribute specifies the scripting language to be used with an associated script bound to the element, typically through an event handler attribute. Possible values might include JavaScript, jScript, VBS, and VBScript.
tabindexnumberSets the tab order of an element.
contenteditablebooleanAllows users to edit content rendered in Internet Explorer 5.5 or greater. Possible values are true or false.
disabledbooleanElements with the disabled attribute set may appear faded and will not respond to user input. Possible values are true or false.
hidefocuson or offThis proprietary attribute, introduced with Internet Explorer 5.5, hides focus on an element's content. Focus must be applied to the element using the tabindex attribute.
unselectableon or offUsed to prevent content displayed in Internet Explorer 5.5 from being selected.