HTML compact attribute

Updated: 09/12/2023 by Computer Hope

The HTML compact attribute is utilized with the <ol>, <ul>, and <dir> HTML tags to reduce the size of a list on a web page. Using the "compact" attribute with the HTML (hypertext markup language) tag reduces the indentation of each line in the list and space between them, conserving space on the web page.

<ul compact>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>

The example above shows how the compact attribute would be used with the <ul> tag.

The compact attribute is a deprecated attribute and no longer supported by the major Internet browsers. It is also not supported in HTML5. Instead, you can use CSS (cascading style sheets) to change line indentation and spacing between lines in a list.

HTML, Internet terms, Web design terms