<dir>
dir Tag
The <dir>
tag was historically used to create a list of directory-style items, with each entry represented by the <li>
tag. It functioned similarly to the <ol>
and <ul>
elements. By default, items were displayed with bullet points.
Example
- HTML
- XHTML
- CSS
<ul>
<li>HTML</li>
<li>XHTML</li>
<li>CSS</li>
</ul>
- Adjusting line height in a list using CSS:
- HTML
- XHTML
- CSS
<ul style="line-height:80%">
<li>HTML</li>
<li>XHTML</li>
<li>CSS</li>
</ul>
DOM Interface
The <dir>
element was associated with the HTMLDirectoryElement interface before being deprecated.
Attributes
This element supports global attributes, which are available to all HTML elements.
Conclusion
The <dir>
tag was once used for listing directory-style items, but it is now obsolete in favor of more modern list elements like <ul>
. For styling and structuring unordered content, <ul>
with appropriate CSS is the recommended approach.
<li>
The HTML <li> element marks an entry in a list, utilized within <ul> (unordered lists) or <ol> (ordered lists) to denote individual items.
<dl>
The HTML <dl> element creates a description list, consisting of <dt> (definition terms) and <dd> (definition descriptions) to display terms alongside their explanations.