HTML Tutorial: Complete HTML Tutorial
About Lesson

HTML <dir> Tag


Concept

The <dir> tag in HTML was used to define a directory list, typically containing a list of files or other resources. However, it’s important to note that this tag is not supported in HTML5, and its usage has been deprecated.

What to Use Instead?

Instead of the <dir> tag, you can use the <ul> tag to create unordered lists.

Implementation

Sponsored by Google

Example 1: Creating a List Using <ul>

Here’s an example of how you can create a list using the <ul> tag instead of the deprecated <dir> tag:

<ul>
  <li>File 1</li>
  <li>File 2</li>
  <li>File 3</li>
</ul>

Example 2: Reducing Line Height in a List with CSS

You can also style the list using CSS to achieve specific visual effects:

<ulstyle="line-height: 1.2;">
  <li>Resource 1</li>
  <li>Resource 2</li>
  <li>Resource 3</li>
</ul>

Try it out below

Loading

Tip: Styling Lists

You can apply various CSS styles to lists to achieve different visual effects and layouts.

Browser Support

Browser Support
Chrome No
Firefox No
Safari No
Opera No
IE No

Conclusion

The <dir> tag is no longer supported in modern browsers, and its usage has been deprecated. Instead, you should use the <ul> tag to create unordered lists and apply CSS for styling as needed.


This approach ensures compatibility with current web standards and browsers.