3 out of 4 rated this helpful - Rate this topic

hasLayout property

[This documentation is preliminary and is subject to change.]

Gets a value that indicates whether the object has layout.

Syntax

hasLayout: VARIANT_FALSE | VARIANT_FALSE

Property values

VARIANT_FALSE

Default. Object does not have layout.

VARIANT_TRUE

Object has layout.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Value

Remarks

The following table shows Cascading Style Sheets (CSS) properties and corresponding values that, if set, cause an element to have a layout.

CSS property Value
display inline-block
height any value
styleFloat left or right
position absolute
width any value
writingMode tb-rl
zoom any value

 

By setting the contentEditable property to true, you can cause an element to have a layout.

The following elements always have layout: body, img, HTMLInputElement, table and td.

As of Microsoft Internet Explorer 6, when the !DOCTYPE declaration specifies strict standards compliance, inline elements ignore the width property and the height property. By setting the width property and the height property, you cannot cause the element to have a layout.

Examples

The following example shows how to use the hasLayout property to determine whether an object has layout.

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


<DIV ID="oWidthSet" STYLE="width:100%">
	DIV element A has its width set to 100%.</DIV>
<DIV ID="oNotSet">DIV element B is not positioned, 
	and neither its height nor width is set.</DIV>
<P>Which DIV element has layout?</P>
<BUTTON onclick="alert(oWidthSet.currentStyle.hasLayout)">
	DIV Element A</BUTTON>
<BUTTON onclick="alert(oNotSet.currentStyle.hasLayout)">
	DIV Element B</BUTTON>

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

 

 

Build date: 3/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
And OVERFLOW: HIDDEN also
DIV STYLE="OVERFLOW: HIDDEN" has layout as well.
Blocks with layout gain height even if they are empty:

no layout:
(empty)
layout by WIDTH: 20PX:
██
layout by OVERFLOW: HIDDEN:
███████████████████████████████████████████████████████
layout with FONT-SIZE: 1PX:
──
(The previous drawings are simulated, I am unable to get it right here)
This effect is unexpected and breaks the arrangement of blocks.

If an list has layout, list markers disappear.
If a list item has layout, it gets number 1.
If a list is within a block with layout, the list gets an extra empty line at the bottom.