English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The compact attribute is a boolean attribute. When present, it specifies that the list should be smaller than normally displayed by reducing the space between lines and the list indentation.
Use the compact attribute in an unordered list:
<ul compact> <li>apple</li> <li>grape</li> <li>melon</li> <li>pineapple</li> </ul>Test to see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers do not support the compact attribute.
HTML5 does not support the <ul> compact attribute. Use CSS instead.
The compact attribute of <ul> in HTML 4.01 deprecated.
The compact attribute is a boolean attribute.
When present, it specifies that the list should be displayed smaller than normal by reducing the space between lines and the indentation of the list.
in HTML 4.01 disapproved the use of the compact attribute of the ul element; in XHTML 1Strict DTD does not support the compact attribute of the ul element.
CSS Syntax: <ul 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, attributes are not allowed to be abbreviated, and the compact attribute must be defined as: <ul compact="compact">.
<ul compact>HTML <ul> tag