You are here: Reference > JavaScript > client-side > style handling > properties > hasLayout (currentStyle)
hasLayout property (currentStyle)
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:
- display: inline-block
- height: with any value
- float: left or right
- position: absolute or fixed
- width: with any value
- writingMode: tb-rl
- and Element has layout if contentEditable property is set to true.
Syntax:
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> <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! </div> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
htmlElement.currentStyle
HTML elements:
a, abbr, acronym, address, applet, area, b, base, basefont, bdo, bgsound, big, blockquote, body, br, button, caption, center, cite, code, col, colgroup, comment, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, link, listing, map, marquee, menu, meta, nobr, noframes, noscript, object, ol, optgroup, option, p, plaintext, pre, q, rt, ruby, s, samp, script, select, small, span, strike, strong, style, sub, sup, table, tbody, td, textarea, tfoot, th, thead, title, tr, tt, u, ul, var, wbr, xml, xmp
Related pages:
External links:
User Contributed Comments