dir

The old HTML <dir> element was intended for directory-style lists. It is obsolete and should not be used in new pages; use <ul> and <li> instead.

What you will learn

Do not use dir for new lists

The element was an early HTML way to display a list of directory entries. It does not provide a useful modern semantic distinction from an unordered list and has inconsistent browser and accessibility behavior.

<!-- Historical markup: do not copy into a new page -->
<dir>
  <li>Reports</li>
  <li>Images</li>
</dir>

Use ul and li instead

<ul>
  <li><a href="reports/">Reports</a></li>
  <li><a href="images/">Images</a></li>
</ul>

Use ul for an unordered collection, ol when order matters, and dl for term-and-description pairs. Choose the list based on meaning rather than its visual style.

Do not confuse the element with the dir attribute

The obsolete dir element is unrelated to the current global dir attribute, which controls writing direction with values such as ltr, rtl, or auto.

<p dir="rtl">Right-to-left text</p>

Common mistakes

Related pages