Dir HTML

HTML <dir> Tag

The HTML <dir> tag is not supported in HTML5. It acts as a container for a list of files, folders, or directory contents. It is used with the <li> tags to display the list of directories in bullets. Instead of the HTML <dir> tag, the <ul> tag and CSS property can be used.

Syntax:

<dir>Directory List</dir>

Example:

<!DOCTYPE html>
<html>
<body>
<h4>Grocery List</h4>
<dir>
<li>Rice</li>
<li>Bread</li>
<li>Flour</li>
<li>Oil</li>
<li>Cheese</li>
</dir>
</body>
</html>

Explanation:

In the above example, we created a Grocery List using the HTML <dir> tag.

Tag specific Attribute:

Attribute Uses
compact Used to define that the list should be displayed smaller than normal. Not supported in HTML5.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.