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

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 specifies the class of the element.

id

id_name

It specifies a unique id for the element.

style

style_definition

It specifies an inline style definition.

title

tooltip_text

It specifies a 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.

Attribute

Value

Description

dir

ltr | rtl

It is used to set the text direction.

lang

language_code

It is used to set the language code.


Microsoft Proprietary Attributes

There are some proprietary attributes introduced by Microsoft with the Internet Explorer 4 and higher versions.

Attribute

Value

Description

accesskey

character

It is 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

It 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 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

It is used to prevent content displayed in internet explorer 5.5 from being selected.