compact attribute | compact property

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
0 out of 1 rated this helpful - Rate this topic

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

true (true)

Removes extra space between objects in list.

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.

In Microsoft Internet Explorer 6 and greater, this property applies to the menu and dir objects.

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</dt>
<dd>A small domesticated mammal.</dd>
<dt>Lizard</dt>
<dd>A reptile generally found in dry areas.</dd>
</dl>
</body>
</html>


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

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/compact.htm



<html>
<body>
<script type="text/ecmascript">
  //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</dt>
<dd>A small domesticated mammal.</dd>
<dt>Lizard</dt> 
<dd>A reptile generally found in dry areas.</dd>
</dl>
</body>
</html>


See also

menu
dir
dl
ul
ol

 

 

Send comments about this topic to Microsoft

Build date: 11/28/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.