HTML
The compact attribute
-
tag
- Coffee
- Tea
- Milk
Example
Using the compact attribute in an unordered list:
Try it »
Browser support





No major browser supports the compact attribute.
Definition and Usage
HTML5 does not support
-
The compact attribute. Use CSS instead.
-
The compact attribute is deprecated in HTML 4.01.
The compact attribute is a boolean attribute.
The compact attribute specifies that the list should be rendered more compactly than normal, by reducing line spacing and indenting the list.
Compatibility notes
In HTML 4.01, the compact attribute of the ul element is deprecated; in XHTML 1.0 Strict DTD, the compact attribute of the ul element is not supported.
CSS syntax:
CSS example: reducing the line height in a list
In our CSS tutorial, you can find more details about The line-height propertydetails.
Differences between HTML and XHTML
In XHTML, attributes cannot be abbreviated, so the compact attribute must be defined as:
-
.
Syntax
HTML
-
tag