{hasLayout} Trident Proprietary CSS Property | CSS: Presentation Layer

Standards Based Development

hasLayout property gets a value that indicates whether the object has layout. Accepts two keyword values: true (if the object has layout) and false (if the object does not have layout); false is default.

css Properties and Values That (When Set) Cause an Element to Have Layout
PropertyValue
displayinline-block
heightany value
styleFloat (float)left or right
positionabsolute
widthany value
writingMode (-ms-writing-mode)tb-rl
zoomany value

Setting contentEditable:true will also cause an element to gain layout.

The following elements always have layout: body, HTMLInputElement (input /), table, and td.

As of ie6, when !DOCTYPE specifies strict standards compliance, inline elements ignore width and height. Setting each or both will not cause an element to have layout.

The example uses hasLayout to determine whether an object has layout. View it live:


<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>

References and Resources