Tutorialspoint.dev

HTML | <dir> Tag

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

Syntax:

<dir> Lists... </dir>

Below example illustrates the <dir> tag in HTML:

Example:

<!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>
                <li>Operating system</li>
                <li>Data Structures</li>
                <li>computer network</li>
                <li>Dbms</li>
                <li>Oops</li>
            </dir>
    </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:

<!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: The browser supported by <dir> tag are listed below:

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


This article is attributed to GeeksforGeeks.org

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter