XHTML Attributes

Some standard XHTML attributes that is associated to all the XHTML tags.

XHTML attributes are divided into three parts:

  • Core Attributes
  • Language Attributes
  • Microsoft Proprietary Attributes

Core Attributes

These attributes are not valid in base, head, html, meta, param, script, style, and title elements.

Attribute Value Description
class class_rule or style_rule Specifies the class of the element
id id_name Specifies a unique id for the element
style style_definition Specifies an inline style definition
title tooltip_text Specifies a text to display in a mouse tip

Language Attributes

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

These attributes are not valid in base, br, frame, frameset, hr, iframe, param, and script elements.

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

Microsoft Proprietary Attributes

These proprietary attributes are introduced by Microsoft with the Internet Explorer of higher versions.

Attribute Value Description
accesskey Character This attribute is used to set a keyboard shortcut to access an element
language String The language attribute is used to specify 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 and VBScript.
tabindex Number This attribute is used to set the tab order of an element
contenteditable Boolean It allows users to edit content rendered in internet explorer 5.5 or higher. Its possible values are true or false.
disabled Boolean It makes the element appear faded and will not respond to user input. Its possible values are true or false.
hidefocus On or Off It hides focus on an element’s content. The focus must be applied to the element using the tabindex attribute.
unselectable On or Off It prevents content displayed in internet explorer 5.5 from being selected.