HTML <ul> compactProperty
Example
Using the compact attribute in an unordered list:
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
None of the major browsers support the compact attribute.
Definition and Usage
HTML5 does not support the <ul> compact attribute. Please use CSS instead.
The compact attribute of <ul> 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, which is achieved 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: <ul style="line-height: 80%">
CSS Example: Reduce line-height in a list
In our CSS tutorial, you can find more aboutline-height PropertyDetails.
Difference between HTML and XHTML
In XHTML, attribute minimization is not allowed, and the compact attribute must be defined as: <ul compact="compact">.
Syntax
HTML <ul> Tagother extensions