HTML <ol> compactAttribute

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

Example

Use the compact attribute in an ordered HTML list:

<ol compact>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note:Almost all mainstream browsers do not support the compact attribute.


Definition and Usage

HTML5 does not support the <ol> compact attribute. Use CSS instead.

In HTML 4.01, the compact attribute of <ol>is deprecated.。

The compact attribute is a boolean attribute.

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


Compatibility Notes

In HTML 4.01, the compact attribute of <ol> is deprecated, use CSS instead.

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

CSS Example: Reduce the line height in a list

In our CSS tutorial, you can find more details aboutthe line-height propertythe details.


Differences Between HTML and XHTML

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


Syntax

<ol compact>


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