HTML <dir> Directory Tag
Tags: learnhtml, htmld
Published: 2021-05-10 08:40:58

---
title: HTML <dir> Directory Tag
published: true
date: 2021-02-23 20:43:31 UTC
tags: LearnHTML,HTMLD
canonical_url: https://sharepointanchor.com/learn-html/html-dir-directory-tag/
---

In HTML, the <dir> Directory tag is the **container for a directory of titles,** files or folders. The items inside the **<dir>** tag are defined in lists by using the **<li>** tag. By default, the list is marked with bullet points.

**Note** : The **<dir>** tag is **deprecated in HTML** , and it is **no longer available in HTML 5**.

![💡](https://s.w.org/images/core/emoji/13.0.1/72x72/1f4a1.png) **Tips** : You can use the **<ul>** or **<ol>** tag to create the list directory titles. Use the **CSS**  **list-style** property to change the style of the lists.

<svg aria-hidden="true" focusable="false" data-icon="clock" width="20" height="20" fill="none" stroke="currentColor" style="display:inline-block;vertical-align:-0.1em" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>Estimated reading time: 4 minutes

## Syntax:

The directory tag contains both the **starting <dir> tag** and **ending </dir> tag**. The content is written between these two tags.

```

<dir>
<li> write your content here </li>
</dir>

```

## Sample of HTML <dir> Tag:

```

<!DOCTYPE html>
<html>
  <head>
    <title>HTML <dir> Tag</title>
  </head>
  <body>
<h3>Example for <dir> Tag </h3>
    <dir>
	<li>Google Chrome </li>
	<li>Firefox</li>
	<li>Opera</li>
	<li>Safari</li>
	<li>Internet Explorer</li>
    </dir>
  </body>
</html>

```

## Result:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/Result-26.png)<figcaption>Result</figcaption>

### Download Sample File:

[HTML-dir-Tag](https://sharepointanchor.com/wp-content/uploads/2021/02/HTML-dir-Tag.html)[Download](https://sharepointanchor.com/wp-content/uploads/2021/02/HTML-dir-Tag.html)

### Use CSS list-style property with HTML <dir> tag:

```

<!DOCTYPE html>
<html>
  <head>
    <title>HTML <dir> Tag</title>
  </head>
   <style>
       dir{ 
          list-style: circle; 
        }
      </style>
  <body>
<h3>HTML <dir> Tag with CSS property</h3>
    <dir>
	<li>Google Chrome </li>
	<li>Firefox</li>
	<li>Opera</li>
	<li>Safari</li>
	<li>Internet Explorer</li>
    </dir>
  </body>
</html>

```

### Result:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/Resul-2.png)<figcaption>Result</figcaption>

## Attributes:

The  **<dir>**  Directory tag supports the  **global attributes**  and the  **event attributes** in HTML.

<style> th, td{ padding: 20px; } </style>

| Attribute | Value | Description |
| --- | --- | --- |
| compact | compact | It helps to **specify that the list should render smaller than normal.**   
 **Not Supported in HTML 5.** |

## Styling Methods for <dir> Tag:

You can use the following properties to style an HTML **<dir>** Directory tag.

### Properties to style the visual weight/emphasis/size of the text in <dir> tag:

- **CSS font-style** – This CSS property helps to set the font style of the text such as normal, italic, oblique, initial, inherit.
- **CSS font-family** – This CSS property specifies a prioritized list of one or more font family names or generic family names for the selected element.
- **CSS font-size** – This CSS property will help to set the size of the font.
- **CSS font-weight** – This CSS property used to define whether the font should be bold or thick.
- **CSS text-transform** – This CSS property will control the text case and capitalization.
- **CSS test-decoration** – This CSS property specifies the decoration added to text such as **text-decoration-line** , **text-decoration-color** , **text-decoration- style**.

### Styles to coloring the text in <dir> Tag:

- **CSS color** – This CSS property will specify the color of the text content and decorations.
- **CSS background-color** – This CSS property helps to set the background color of an element. 

### Text layout styles for <dir> Tag:

- **CSS text-indent** – This CSS property is used to specify the indentation of the first line in a text block.
- **CSS text-overflow ** – This CSS property helps to describe how overflowed content that is not displayed should be signaled to the user.
- **CSS white-space** – This CSS property describes how white-space inside an element is handled.
- **CSS word-break**  – This CSS property decides where the lines should be broken.

### Other Properties for <dir> Tag:

- **CSS text-shadow**  – This CSS property helps to add the shadow to text.
- **CSS text-align-last**  – This CSS property will set the alignment of the last line of the text.
- **CSS line-height** – This CSS property defines the height of a line.
- **CSS letter-spacing** – This CSS property helps to decide the spaces between letters/characters in a text.
- **CSS word-spacing** – This CSS property specifies the spacing between every word.

## Browser Support:

![](https://sharepointanchor.com/wp-content/uploads/2021/02/Browser-Support-10.png)<figcaption>Browser Support</figcaption>

### Related Articles:

- **[HTML <center> Center Tag](https://sharepointanchor.com/learn-html/html-center-tag/)**
- **[HTML <code> Code Tag](https://sharepointanchor.com/learn-html/html-code-tag/)**
- **[Basic HTML Definitions and Usages in the Real World](https://sharepointanchor.com/learn-html/basic-html-definitions-and-usages-in-real-world/)**
- **[HTML <aside> Aside Tag](https://sharepointanchor.com/learn-html/html-aside-tag/)**
- **[HTML <detail> Details Tag](https://sharepointanchor.com/learn-html/html-details-tag/)**

The post [HTML <code><dir></code> Directory Tag](https://sharepointanchor.com/learn-html/html-dir-directory-tag/) appeared first on [Share Point Anchor](https://sharepointanchor.com).