COMPACT Attribute | compact Property
| DHTML文档教程 |
Sets or retrieves a Boolean value indicating whether the list should be compacted by removing extra space between list objects.
What's New for Internet Explorer 6
This property now applies to the
menu and
dir objects.
dhtml语法
HTML | <ELEMENT COMPACT
... >
|
---|
Scripting | object.compact(v) [ = bCompactList ] |
---|
DHTML可能的值
bCompactList | Boolean that
specifies or receives one of the following values.true | Removes extra space between objects in list. | false | Default. Does not remove extra space between objects in list. |
|
The property is read/write.
The property has a default value of
false.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
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 Microsoft JScript®
<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>
This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
是否符合公共标准
This property is deprecated in
HTML and
is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To