How to display a directory list in HTML?


Use the dir tag in HTML to display directory list. This is very similar to <ul> tag but do not use <dir> since it is deprecated now.

The following is the attribute −

Attribute
Value
Description
Compact
compact
Deprecated − Specifies a compact rendering.

Example

You can try to run the following code to show a directory list in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML dir Tag</title>
   </head>
   <body>
      <p>The following are the values:</p>
      <dir>
         <li>car</li>
         <li>bike</li>
         <li>ship</li>
      </dir>
   </body>
</html>

Updated on: 03-Mar-2020

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements