W3docs

HTML <dir> Tag

The <dir> tag is used to list directory titles. The tag is obsolete in HTML5. See what to use instead.

The <dir> tag is used to define a list of directory titles. The items inside the list are defined using the <li> tag (as with HTML lists that are defined using <ol> and <ul> tags). The list of directory titles is marked with bullets by default.

Danger

The <dir> tag is a deprecated HTML tag and not supported in HTML5. Use the <ul> tag and CSS list-style property instead (see examples below).

Syntax

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

Example of the HTML <dir> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <dir>
      <li>HTML Tutorial</li>
      <li>CSS Tutorial</li>
      <li>PHP Tutorial</li>
    </dir>
  </body>
</html>

Result

dir example

Example of the CSS list-style property:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      ul { 
        list-style: disc; 
      }
    </style>
  </head>
  <body>
    <ul>
      <li>HTML Tutorial</li>
      <li>CSS Tutorial</li>
      <li>PHP Tutorial</li>
    </ul>
  </body>
</html>

Attributes

AttributeValueDescription
compactcompactSpecifies that the list should render smaller than normal. Not supported in HTML5.

The <dir> tag also supports the Global Attributes and the Event Attributes.

Practice

Practice

What does the HTML 'dir' tag do?