English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML 参考手册

HTML 标签大全

HTML: <dir> Tag

已废弃的 HTML 目录元素( <dir>)被作为一个文件和/或文件夹的目录的容器,可能还有 用户代理 应用的样式与图标。 不要使用这个元素。虽然它出现在早期的 HTML 规范中,它已经在 HTML4 中废除了,并且在 HTML5 中过时。使用 <ul> 来代替。

在线示例

目录列表:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>基础教程(oldtoolbag.com)</title> 
</head>
<body>
<dir>
  <li>html</li>
  <li>xhtml</li>
  <li>css</li>
</dir>
</body>
</html>
</html>
测试看看 ‹/›

浏览器兼容性

IEFirefoxOperaChromeSafari

所有主流浏览器都支持 <dir> 标签。

标签定义及使用说明

HTML5 不支持 <dir> 标签。请用 CSS 代替。

In HTML 4.01 中,<dir> 元素 已废弃。

<dir> 标签被用来定义目录列表。

提示和注意

提示:请使用 CSS 来为列表添加样式!在我们的 CSS 教程中,您可以找到更多有关为列表添加样式的细节。

HTML 4.01 与 HTML5之间的差异

HTML5 不支持 <dir> 标签,HTML 4.01 已废弃 <dir> 标签。

可选的属性

AttributeValueDescription
compactcompactHTML5 不支持。HTML 4.01 已废弃。    指定列表必须比常规状态小一号呈现。

Standard Attributes

In HTML 4.01 中,<dir> 标签支持如下标准属性:

AttributeValueDescription
classclassname指定元素的类名
dirrtl
ltr
指定元素中内容的文本方向
ididSpecify the unique id of the element
langlanguage_codeSpecify the language code for the content of the element
stylestyle_definitionSpecify the inline style of the element
titletextSpecify additional information for the element

For a complete description, please visitStandard Attributes.

Event Attributes

In HTML 4.01 In, the <dir> tag supports the following event attributes:

AttributeValueDescription
onclickscriptExecute script when the mouse is clicked
ondblclickscriptExecute script when the mouse is double-clicked
onmousedownscriptExecute script when the mouse button is pressed
onmousemovescriptExecute script when the mouse pointer moves
onmouseoutscriptExecute script when the mouse pointer leaves an element
onmouseoverscriptExecute script when the mouse pointer hovers over an element
onmouseupscriptExecute script when the mouse button is released
onkeydownscriptExecute script when the keyboard is pressed
onkeypressscriptExecute script when the keyboard is pressed and then released
onkeyupscriptExecute script when the keyboard is released

For a complete description, please visitEvent Attributes.