HTML <dir> Tag
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
Please Login to comment...