X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <ul> compact Attribute

HTML ul Tag Reference HTML <ul> tag

Example

Use of the compact attribute in an unordered HTML list:

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

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The compact attribute is not supported by any of the major browsers.


Definition and Usage

The compact attribute is a boolean attribute.

When present, it specifies that the list should render smaller than normal, by reducing the space between lines and the indentation of the list.


Compatibility Notes

The compact attribute of <ul> is not supported in HTML5. Use CSS instead.

CSS syntax: <ul style="line-height: 80%">

CSS Example: Reduce 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

<ul compact>


HTML ul Tag Reference HTML <ul> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook