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

HTML Reference Manual

HTML Tag大全

HTML: <dir> Tag

The deprecated HTML directory element (<dir>) is used as a file and/or folder directory container, there may also be styles and icons applied by the user agent. Do not use this element. Although it appeared in early HTML specifications, it has been deprecated in HTML4 has been deprecated and is also deprecated in HTML5 is deprecated. Use <ul> instead.

Online Example

Directory List:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>Basic Tutorial(oldtoolbag.com)</title> 
</head>
<body>
<dir>
  <li>html</li>
  <li>xhtml</li>
  <li>css</li>
</dir>
</body>
</html>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the <dir> tag.

Tag definition and usage instructions

HTML5 The <dir> tag is not supported. Please use CSS instead.

In HTML 4.01 In, the <dir> element is deprecated.

The <dir> tag is used to define directory lists.

Tips and Notes

Tip:Use CSS to add styles to the list! You can find more aboutAdd styles to the listdetails.

HTML 4.01 and HTML5The differences between

HTML5 The <dir> tag is not supported, HTML 4.01 The <dir> tag is deprecated.

Optional attributes

AttributeValueDescription
compactcompactHTML5 Not supported. HTML 4.01 Deprecated.    The specified list must be presented one size smaller than the conventional state.

Standard Attributes

In HTML 4.01 The <dir> tag supports the following standard attributes:

AttributeValueDescription
classclassnameThe class name of the specified element
dirrtl
ltr
The text direction of the content within the specified element
ididSpecify the unique id of the element
langlanguage_codeSpecify the language code for the content within 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 moves out of 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.