HTML <dir> tag

Use of <dir> tag

The <dir> tag is not supported in HTML5. It is used to create directory contents or lists of file names. <dir> tag is similar with <ul> tag which performs the same function to make unordered lists.
Type: Block Element

Example of <dir> tag

    <dir>
       <li> HTML </li>
       <li> CSS </li>
       <li> JavaScript </li>
    </dir>

Supported Browsers

Tag Chrome browser Internet explorer browser Firefox browser Safari browser Opera browser
<dir> Yes Yes Yes Yes Yes

Full Code Example

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <dir>
       <li> HTML </li>
       <li> CSS </li>
       <li> JavaScript </li>
    </dir>
</body>
</html>

Output

  • HTML
  • CSS
  • JavaScript
  • More reference

    In the past, <dir> tag was used to create the unordered lists which has been replaced by <ul> tag in HTML5. So, we highly recommended to use <ul> tag instead of <dir> tag. <dir> element is not supported in HTML5.

    See the below example

        <ul>
           <li> HTML </li>
           <li> CSS </li>
           <li> JavaScript </li>
        </ul>

    Attribute of <dir> tag

    Attribute Value Notes
    compact compact It defines the smaller gap between each list(by vertically) rather than the normal.

    Note that: Don't use compact attribute because it is depreciated in HTML5.