HTML <dir> Tag

<dir> element was being used to list the directory titles.

The <dir> tag comes in pairs. The content must be written between opening ( <dir> ) and closing ( </dir>) tags.

However, <dir> tag is not in use after HTML5. We have to use <ul> or CSS instead of it.

Let's see an example with <dir> tag:

<!DOCTYPE html>
<html>
   <body>
      <dir>
         <li>Haysoccer</li>
         <li>W3Docs</li>
         <li>Jamanc</li>
      </dir>
   </body>
</html>

Let's see an example with <ul> tag:

<!DOCTYPE html>
<html>
   <body>
      <ul>
         <li>Haysoccer</li>
         <li>W3Docs</li>
         <li>Jamanc</li>
      </ul>
   </body>
</html>

Let's see an example with CSS list-style property tag:

<!DOCTYPE html>
<html>
   <body>
      <head>
         <style>
            ul{ list-style:disc; }
         </style>
      </head>
      <ul>
         <li>Haysoccer</li>
         <li>W3Docs</li>
         <li>Jamanc</li>
      </ul>
   </body>
</html>

Here the result is:


Attributes:

Attributes Value Description
compact compact It defines that the list must be shown smaller than normal.
It is not in use anymore after HTML5.