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.

hasLayout property

Gets a value that indicates whether the object has layout.

Internet Explorer 9

 

Syntax

hasLayout: |

Property values

false

Default. Object does not have layout.

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


<!DOCTYPE html>
<html>
<head>
  <title>hasLayout Property</title>
</head>

<body>
  <h1>hasLayout Property</h1>
  <p>This example uses the <strong>hasLayout</strong> property of the <strong>currentStyle</strong> object to 
    show that an element has layout when it is absolutely positioned, or when its height and/or width are specified.  
    The <strong>hasLayout</strong> property returns <strong>true</strong> for an object that has layout, and 
    <strong>false</strong> for an object that has no layout.</p>
  <fieldset style="width: 50%; text-align: center;">
    <legend><strong>hasLayout</strong> Property</legend>
    <p style="text-align: left;"><em>Which DIV element has layout?</em></p>
    <div id="oWidthSet" style="width: 100%; text-align: left;"><strong>DIV</strong> element A has its <strong>width</strong> set to <strong>100%</strong>.</div>
    <div id="oNotSet" style="text-align: left;"><strong>DIV</strong> element B is not positioned, and neither its <strong>height</strong> nor <strong>width</strong> is set.</div>
    <br>
    <button onclick="document.getElementById('messageBox').textContent = document.getElementById('oWidthSet').currentStyle.hasLayout;">DIV Element A</button>
    <button onclick="document.getElementById('messageBox').textContent = document.getElementById('oNotSet').currentStyle.hasLayout;">DIV Element B</button>
  </fieldset>
  <div id="messageBox" style="padding-top: 1em; font-weight: bold;"></div>
</body>
</html>

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

currentStyle

 

 

Show:
© 2014 Microsoft