HTML <dir> tag
The <dir> tag is used to create directory contents or lists of file names.
This element was used in older HTML and is not supported in HTML5 even though some brower support it.
Type: Block Element
Syntax of <dir> tag
<dir> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </dir>
Supported Browsers
| Tag | Chrome | Internet Explorer | Firefox | Safari | Opera Mini |
|---|---|---|---|---|---|
| <dir> | Yes | Yes | Yes | Yes | Yes |
Full code example
<!DOCTYPE html> <html> <head> </head> <body> <dir> <li>HTML</li> <li>CSS</li> <li>JS</li> </dir> </body> </html>
- HTML
- CSS
- JS
Attribute of <dir> tag
| Attribute | Value | Define |
|---|---|---|
| compact | compact | It defines the smaller gap between each list (by vertically) rather than the normal. |
Note: Even the <dir> tag is obsolete in modern HTML, you don't have to use the compact attribute.
More reference
Earlier, the <dir> tag was used to create an unordered list or folder. In HTML 5, this tag is replaced completely by <ul> tag.
Example of using <ul> tag
<ul> <li>List 1</li> <li>List 2</li> </ul>
