You are here: Reference > HTML > attributes > COMPACT (dir, dl, menu, ol, ul)

COMPACT attribute (dir, dl, menu, ol, ul)

Browser support:
Sets whether extra space between list items should be removed.
In Internet Explorer, this functionality is only implemented for the definition list element. In other commonly used browsers the COMPACT attribute doesn't work properly for all elements. This attribute is deprecated in HTML 4.01, but there is no other way to remove extra spaces between definition list elements.
JavaScript page for this attribute: compact. You can find other example(s) there.

Possible values:

This attribute has no values.
Specifying the COMPACT attribute with an arbitrary value has the same effect as specifying it with no value.
For example, all of the following declarations have the same effect: compact, compact="true", compact="false", compact="on", compact="compact".
Although Boolean attributes may be used with no value in HTML, for XHTML compatibility, always use the COMPACT attribute in the following format: compact="compact".

Example HTML code 1:

This example illustrates the use of the COMPACT attribute in Internet Explorer:
<b>List, with compact:</b>
<dl compact="compact">
    <dt>Apple</dt>
    <dd>Apple is one of the most widely cultivated tree fruits.</dd>
    <dt>Pear</dt>
    <dd>Pears are trees of the genus Pyrus and the fruit of that tree, edible in some species.</dd>
</dl>

<br />

<b>List, without compact:</b>
<dl>
    <dt>Apple</dt>
    <dd>Apple is one of the most widely cultivated tree fruits.</dd>
    <dt>Pear</dt>
    <dd>Pears are trees of the genus Pyrus and the fruit of that tree, edible in some species.</dd>
</dl>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content