Xhtml 简明教程
XHTML - Attributes
有少数几个 XHTML/HTML 特性是所有 XHTML/HTML 标签的标准且关联的。这些特性在此列出并附有简短说明−
There are a few XHTML/HTML attributes which are standard and associated to all the XHTML/HTML tags. These attributes are listed here with brief description −
Core Attributes
在 base、head、html、meta、param、script、style 和 title 元素中无效。
Not valid in base, head, html, meta, param, script, style, and title elements.
Attribute |
Value |
Description |
class |
class_rule or style_rule |
The class of the element. |
Id |
id_name |
A unique id for the element. |
style |
style_definition |
An inline style definition. |
Title |
tooltip_text |
A text to display in a mouse tip. |
Language Attributes
lang 特性表明正在为封闭内容使用哪种语言。语言使用 ISO 标准语言缩写来识别,例如, fr 表示法语, en 表示英语,等等。更多代码和它们的格式在 www.ietf.org 中有描述。
The lang attribute indicates the language being used for the enclosed content. The language is identified using the ISO standard language abbreviations, such as fr for French, en for English, and so on. More codes and their formats are described at www.ietf.org.
在 base、br、frame、frameset、hr、iframe、param 和 script 元素中无效。
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements.
Attribute |
Value |
Description |
dir |
ltr |
rtl |
Sets the text direction. |
lang |
language_code |
Microsoft Proprietary Attributes
微软通过 Internet Explorer 4 及更高版本引入了许多新的私有特性。
Microsoft introduced a number of new proprietary attributes with the Internet Explorer 4 and higher versions.
Attribute |
Value |
Description |
accesskey |
character |
Sets a keyboard shortcut to access an element. |
language |
string |
This 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. |
tabindex |
number |
Sets the tab order of an element. |
contenteditable |
boolean |
Allows users to edit content rendered in Internet Explorer 5.5 or greater. Possible values are true or false. |
disabled |
boolean |
Elements with the disabled attribute set may appear faded and will not respond to user input. 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. 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. |