<dir> Tag in HTML

The <dir> tag was used in early HTML versions to create a directory-style list. It is a block-level element that was commonly used to display a list of files or folders. As it is deprecated, modern HTML recommends using the <ul> or <ol> tags instead.

Syntax of <dir> Tag:

Syntax Example

<dir>
            <li>Item 1</li>
            <li>Item 2</li>
            <li>Item 3</li>
        </dir>

Example of <dir> Tag in HTML:

This example demonstrates how the deprecated <dir> tag might look in HTML.

Code Example


        <dir>
            <li>Documents</li>
            <li>Downloads</li>
            <li>Music</li>
        </dir>
                

Output

  • Documents
  • Downloads
  • Music
  • The <dir> tag is not supported in modern HTML5 and is no longer recommended. Use <ul> or <ol> for lists instead, as they are more accessible and widely supported.