compact attribute | compact property

Sets or retrieves a Boolean value indicating whether the list should be compacted by removing extra space between list objects.

Syntax

HTML<element compact="p" ... >
JavaScript

p = object.compact

Property values

Type: Boolean

VARIANT_TRUE (true)

Removes extra space between objects in list.

VARIANT_FALSE (false)

Default. Does not remove extra space between objects in list.

Standards information

Remarks

There is no functionality implemented for the compact property for the ul, ol, dir and menu elements unless defined by the author.

Examples

The following example shows how to use the compact property in HTML. Note that the presence of the word COMPACT sets the compact property to true



<HTML>
<BODY>
<DL COMPACT>
<DT>Cat
<DD>A small domesticated mammal.
<DT>Lizard
<DD>A reptile generally found in dry areas.
</DL>
</BODY>
</HTML>


The following example shows how to set the compact property using JavaScript



<HTML>
<BODY>
<script>
//Function that toggles the compact property for the DL element below
function compactDLToggle()
{
animals.compact = !animals.compact;
toggle.innerText = "Compact = "+animals.compact;
}
</script>
<P style="color:blue; font-weight:bold">Effect of setting COMPACT property for a DL element</P>
<BUTTON id="toggle" onclick="compactDLToggle()">Toggle Compact Property</BUTTON>
<DL id=animals>
<DT>Cat
<DD>A small domesticated mammal.
<DT>Lizard
<DD>A reptile generally found in dry areas.
</DL>
</BODY>
</HTML>


See also

dl
ul
ol

 

 

Build date: 10/15/2012

Show:
© 2014 Microsoft. All rights reserved.