You are here: Reference > JavaScript > client-side > style handling > properties > hasLayout (currentStyle)

hasLayout property (currentStyle)

Browser support:
Returns a Boolean value that indicates whether the object has layout or not.
Sometimes you need to know whether an element has layout or not, because some style properties only have effect on elements that have layout. An element has layout if any of the following style definitions is set:


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Boolean that indicates whether the object has layout.
One of the following values:
Element does not have layout.
Element has layout.
Default: false.

Example HTML code 1:

This example illustrates the use of the hasLayout property:
<div style="height:100px;background:#F2F2F2" onclick="alert (this.currentStyle.hasLayout)">
    This division element has layout because its height is set to 100px.
    <br />
    Click to check!
<div style="background:#18F2F2" onclick="alert (this.currentStyle.hasLayout)">
    This division element does not have layout because none of its layout properties are set.
    <br />
    Click to check!
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content