THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <dir> compact Attribute

HTML dir Tag Reference HTML <dir> tag

Example

Use of the compact attribute in a directory list:

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

Try it Yourself »

Definition and Usage

The compact attribute is a boolean attribute.

When present, it specifies that the list should render smaller than normal, by reducing the space between lines and the indentation of the list.


Browser Support

Attribute
compact Not supported Not supported Not supported Not supported Not supported

Compatibility Notes

The compact attribute of <dir> is not supported in HTML5. Use CSS instead.

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

CSS Example: Reduce line-height in a list

In our CSS tutorial you can find more details about the line-height property.


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 Tag Reference HTML <dir> tag

COLOR PICKER

colorpicker

SHARE THIS PAGE






Search w3schools.com:

Translate w3schools.com: