Easy Tutorial
❮ Tag Ol Tag Doctype ❯

HTML <ul> compact Attribute

HTML <ul> Tag

Example

Using the compact attribute in an unordered list:


Browser Support

All major browsers do not support the compact attribute.


Definition and Usage

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 presented in a smaller, more compact style, achieved by reducing line spacing and indenting the list.


Compatibility Notes

In HTML 4.01, the compact attribute of the ul element was 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: Reducing line height in a list

In our CSS tutorial, you can find more details about the line-height property.


Differences Between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the compact attribute must be defined as: <ul compact="compact">.


Syntax


❮ Tag Ol Tag Doctype ❯