Skip to content
Related Articles

Related Articles

HTML | <dir> compact Attribute

View Discussion
Improve Article
Save Article
  • Last Updated : 09 Mar, 2022
View Discussion
Improve Article
Save Article

The HTML <dir> compact Attribute is used to define the list should be smaller than the normal by reducing the space between the list items and the indentation of the list. It is a Boolean attribute.
Syntax: 
 

<dir compact>

Note: The HTML <dir> compact attribute is not supported by HTML 5 instead of using this we can use CSS line-height property.

Below example illustrates the use of <dir> compact attribute.
Example: 
 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML dir compact Attribute
    </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">
        HTML <dir> compact Attribute
    </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: 
 

Supported Browsers: The HTML <dir> compact attribute is not supported by any browsers.
 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!