**`<dir>`** dates back to early HTML as a way to mark up a list of filenames, typically rendered in a compact, multi-column style by very old browsers. It never had any functionality that a plain `<ul>` couldn't also provide, and HTML5 formally deprecated it — modern browsers render `<dir>` exactly like an unstyled `<ul>`, with no special multi-column file-listing behavior at all.
1Understanding <dir>
`<dir>` dates back to early HTML as a way to mark up a list of filenames, typically rendered in a compact, multi-column style by very old browsers. It never had any functionality that a plain <ul> couldn't also provide, and HTML5 formally deprecated it — modern browsers render <dir> exactly like an unstyled <ul>, with no special multi-column file-listing behavior at all.
If you find <dir> in legacy code, it's always safe to replace it directly with <ul> — there's no behavioral difference to account for in modern browsers.
<!-- Old, deprecated markup -->
<dir>
<li>report.pdf</li>
<li>notes.txt</li>
</dir>2Practical Example
Here is a real-world application of <dir> showing how it is used in production HTML.
<!-- Correct modern replacement -->
<ul>
<li>report.pdf</li>
<li>notes.txt</li>
</ul>3Best Practices
Follow these guidelines when working with <dir>:
1. Never use <dir> in new code — it's obsolete
2. Replace any legacy <dir> usage with <ul>
3. Use CSS (like columns or flexbox/grid) if you specifically need a multi-column list layout
Tip: If you find <dir> in legacy code, it's always safe to replace it directly with <ul> — there's no behavioral difference to account for in modern browsers.
<!-- Old, deprecated markup -->
<dir>
<li>report.pdf</li>
<li>notes.txt</li>
</dir>