Attributes of XHTML

 

Some XHTML attributes are the same for all XHTML tags and go with them. There are three different kinds of XHTML attributes:

  • Core Attributes
  • Language Attributes
  • Microsoft Proprietary Attributes

Core Attributes

The base, head, html, meta, param, script, style, and title elements can\’t have the core attribute.

AttributeValueDescription
classclass_rule or style_ruleIt specifies the element\’s class.
idid_nameIt specifies the element\’s  unique id.
stylestyle_definitionIt describes the definition of an inline style.
titletooltip_textIt specifies the text that will be displayed in the mouse tip.

Language Attributes

The lang attribute says what language the content inside is written in. It uses the ISO standard abbreviations for languages, like fr for French, en for English, etc. The language attribute is not allowed in the base, br, frame, frameset, hr, iframe, param, and script elements.

AttributeValueDescription
dirltr | rtlThe direction of the text is determined by it.
langlanguage_codeTo set the language code, use this.

Microsoft Proprietary Attributes

There are some features that are unique to Microsoft that were added to Internet Explorer 4 and later.

AttributeValueDescription
accesskeycharacterIt is used to assign a keyboard shortcut to an element.
languageStringThis attribute is indicates the scripting language which is used with the script connected to the element, often through an event handler attribute. JavaScript, jScript, VBS, and VBScript are all potential values.
tabindexNumberIt is used to specify an element\’s tab order.
contenteditableBooleanIt allows users to alter content that has been rendered in Internet Explorer 5.5 or higher.
It has two possible values: true or false.
disabledBooleanThe disabled attribute fades the element and prevents it from responding to user input.
It has two possible values: true or false.
hidefocusOn or OffThis proprietary feature, introduced with Internet Explorer 5.5, hides the focus on the content of an element. It states that the tabindex attribute must be used to apply attention to the element.
unselectableOn or OffIt is used to prevent the selection of content presented in Internet Explorer 5.5.