HTML <dir> compactAttribute

HTML dir 标签参考手册HTML <dir> Tag

Examples

Use the compact attribute in a directory list:

<dir compact>
  <li>html</li>
  <li>xhtml</li>
  <li>css</li>
</dir>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note:Currently all major browsers do not support the compact attribute.


Definition and Usage

The <dir> tag is no longer supported in HTML5. Use CSS instead.

The compact attribute of <dir> is deprecated in HTML 4.01.

The compact attribute is a boolean attribute.

The compact attribute specifies that the list should render smaller than normal, achieved by reducing line spacing and indenting the list.


Compatibility Notes

The compact attribute of <dir> is deprecated in HTML 4.01. Use CSS instead.

CSS syntax: <dir style="line-height: 80%">

CSS Example: Reduce the line height in a list

In our CSS tutorial, you can find more details aboutline-height propertythe details of the attribute.


Differences Between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the compact attribute must be defined as: <dir compact="compact">.


Syntax

<dir compact>


HTML dir 标签参考手册HTML <dir> Tag Other Extensions