HTML <ul> compactProperty

HTML <ul> Tag

Example

Using the compact attribute in an unordered list:

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

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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

<ul compact>


HTML <ul> Tagother extensions