The <dir> (directory) element was a container for a list of files or folders, with <li> children. Early HTML used it before unordered lists became the standard pattern.
Do not use it in new pages. Use <ul> for lists of any kind, including file listings. Nested <ul> elements cover folder trees.
Deprecated · Obsolete.
Present in early HTML, deprecated in HTML 4, and removed from the living HTML standard. Avoid in every new project.
Not the dir attribute.
The global dir attribute sets text direction (ltr, rtl, auto). It is valid HTML and unrelated to this obsolete list tag.
Syntax
HTML Syntax
syntax.html
<dir><li>…</li></dir>
Historical form only. Both tags wrapped <li> items, much like <ul>. Prefer this modern equivalent:
Most mistakes mix up the tag with the attribute, or copy legacy lists into new pages.
naming
Element ≠ attribute
<dir> was a list. The global dir attribute only controls text direction.
obsolete
Still rendering ≠ allowed
Browsers may paint old <dir> for compatibility. Validators and the HTML standard still reject it for authors.
compact
Skip compact
Deprecated and non-standard. Tighten lists with CSS (line-height, margin) on <ul>.
siblings
Related legacy lists
Old <menu> usage was also list-like. Prefer <ul> or semantic <nav> for navigation.
a11y
Use real lists
Screen readers announce proper <ul>/<ol> structure. Stick to those instead of reinventing lists with divs or obsolete tags.
Compatibility
Browser Support
Engines may still render <dir> for old pages, but authors must not use it. Prefer <ul> everywhere.
✓ Deprecated · Obsolete
<dir>
Legacy compatibility only. Chrome, Firefox, Safari, Edge, and Opera may display dir like a list, but the element is removed from the HTML living standard. Always migrate to ul.
N/ADo not use in new HTML
Google ChromeLegacy render
Do not use
Mozilla FirefoxLegacy render
Do not use
Apple SafariLegacy render
Do not use
Microsoft EdgeLegacy render
Do not use
OperaLegacy render
Do not use
Samsung InternetLegacy render
Do not use
Internet ExplorerLegacy render
Do not use
<dir>Obsolete (use <ul>)
Bottom line: Recognize <dir> in old markup, then replace it with <ul>. Never add dir to new documents.
Remember
Key Takeaways
Role:<dir> was a directory list with <li> children — now obsolete.
Replace: use <ul> (and nested <ul>) for file and folder lists.
Name clash: the global dir attribute is for text direction, not lists.
compact: deprecated/non-standard — control spacing with CSS.
One line: never write <dir>; write <ul> for directory-style lists.
UA style
Default CSS Settings
For compatibility, user agents typically style dir like an unordered list: