English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The compact attribute is a boolean attribute that, when present, specifies that the list should be displayed smaller than the normal display by reducing the spacing between lines and the indentation of the list.
Using the compact attribute in ordered HTML lists:
<!DOCTYPE html> <html> <head> <title>HTML: <ol> compact attribute - Basic Tutorial Website(oldtoolbag.com)</title> </head> <body> <ol compact> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
Note:Almost all mainstream browsers do not support the compact attribute.
HTML5 The <ol> compact attribute is not supported. Please use CSS instead.
In HTML 4.01 In the <ol> tag, the compact attribute is deprecated.
The compact attribute is a boolean attribute.
When present, it specifies that the list should be displayed smaller than the normal by reducing the space between lines and the list's indentation.
In HTML 4.01 In the <ol> tag, the compact attribute is deprecated, please use CSS instead.
CSS syntax: <ol style="line-height: 80%">
CSS Example: Reduce the line height in the list
In our CSS tutorial, you can find more about line-height attribute . Details.
In XHTML, attribute shorthand is prohibited, and the compact attribute must be defined as <ol compact="compact">.
<ol compact>HTML <ol> tag