Open In App
Related Articles

HTML <dir> Tag

Improve Article
Improve
Save Article
Save
Like Article
Like

It is used to make a list of directory titles. It is not supported in HTML 5 <ul> or CSS are used instead of <dir> tag.

Syntax: 

<dir> Lists... </dir>

Below example illustrates the <dir> tag in HTML:
Example: 

HTML




<!DOCTYPE html>
<html>
    <body>
       
        <h1>GeeksforGeeks</h1>
        <h2><dir> Tag</h2>
         
<p>List of all computer science subjects:</p>
 
            <!-- dir tag starts here-->
            <dir>
                <li>Operating system</li>
                <li>Data Structures</li>
                <li>computer network</li>
                <li>Dbms</li>
                <li>Oops</li>
            </dir>
            <!-- dir tag ends here-->
                         
    </body>
</html>                   


Output: 
 

Optional Attributes: This tag contains single attributes Compact which is optional. It is used to specify the list size render smaller than normal by reducing the space between list items. It is a boolean attribute.
Example: 

HTML




<!DOCTYPE html>
<html>
    <head>
        <title>dir tag</title>
        <style>
            .gfg {
                font-size:40px;
                font-weight:bold;
                color:green;
            }
            .geeks {
                font-size:25px;
                font-weight:bold;
            }
        </style>
    </head>
    <body>
        <div class = "gfg">GeeksforGeeks</div>
        <div class = "geeks"><dir> Tag</div>
         
<p>List of all computer science subjects:</p>
 
            <dir compact>
                <li>Operating system</li>
                <li>Data Structures</li>
                <li>computer network</li>
                <li>Dbms</li>
                <li>Oops</li>
            </dir>
    </body>
</html>                   


Output: 
 

Note: The compact attribute is not supported by any browser.

Supported Browsers: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 17 Mar, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials