On having layout — the concept of hasLayout in IE/Win
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
URL Tag Cloud
Bookmark History
Saved by 91 people (-26 private), first by anonymouse user on 2006-03-02
- Scayla on 2009-10-27 - Tags ie6
- Haltersweb on 2009-10-05 - Tags has , layout , haslayout , zoom , double , margin , ie6
- Olimay on 2009-09-15 - Tags css , ie , layout , webdesign , design , hacks , reference , haslayout , ie6 , html
- Muratsahin on 2009-08-30 - Tags layout , design , css , hacks , reference , web design
- Jedatu on 2009-07-31 - Tags css , webdesign , hacks , haslayout , reference , ie , howto , html , webdev
Public Sticky notes
Highlighted by bluecockatoo
Consequences of an element having, or not having “layout” can include:
- Many common IE float bugs.
- Boxes themselves treating basic properties differently.
- Margin collapsing between a container and its descendants.
- Various problems with the construction of lists.
- Differences in the positioning of background images.
- Differences between browsers when using scripting
Highlighted by bluecockatoo
The following CSS property/value pairs will, if applied, allow an element to gain layout.
position: absolute- Refers to its containing block, and that's where some problems begin.
float: left|right- The float model has a lot of quirks due to some aspects of a layout element.
display: inline-block- Sometimes a cure when the element is at inline level and needs layout. Applying layout is probably the only real effect of this property. The “inline-block behaviour” itself can be achieved in IE, but quite independently: IE/Win: inline-block and hasLayout.
width: any value other than 'auto'- This is often an implicit fix, more often the trigger when hasLayout does things wrong.
height: any value other than 'auto'- height: 1% is used in the Holly Hack.
zoom: any value other than 'normal'(MSDN)- MS proprietary, does not validate.
zoom: 1can be used for debugging. writing-mode: tb-rl(MSDN)- MS proprietary, does not validate.
Highlighted by bluecockatoo
As of IE7, overflow became a layout-trigger.
overflow: hidden|scroll|auto- This property did not apply in prior versions, unless “layout” was added to the box by other triggers.
overflow-x|-y: hidden|scroll|auto- As part of the CSS3 box model module, overflow-x and -y are not widely implemented yet. They did not trigger hasLayout in prior versions of IE.
Highlighted by bluecockatoo
display: inline behave in a similar way as what the standards say about inline-block: they flow horizontally like words in a paragraph, are sensitive to vertical align, and apply a sort of shrink-wrapping to their content. As soon as the inline elements have layout, they act as inline-block, this is an explanation why, in IE/Win, inline elements can contain and hold block-level elements with less problems than in other browsers, where display: inline remains inline.
Highlighted by bluecockatoo
width and height trigger hasLayout in IE 5.x and IE 6 or newer in quirks mode only. As of IE6, when the browser is in “standards-compliance mode” inline elements will ignore the width and height properties, and setting the width and height properties will not cause the element to have layout.
Highlighted by bluecockatoo
Highlighted by tkabbs
Highlighted by cvdlinden
Highlighted by pklausner
Highlighted by madchicken
Highlighted by kenyth
Highlighted by haltersweb
Highlighted by scootermac315
Highlighted by haltersweb
Highlighted by scootermac315
Highlighted by scootermac315
Highlighted by kenyth
Highlighted by haltersweb
Highlighted by kenyth
Highlighted by scootermac315
Highlighted by kenyth
width: any value other than 'auto'Highlighted by scootermac315
Highlighted by kenyth
height: any value other than 'auto'Highlighted by scootermac315
zoom: any value other than 'normal'
Highlighted by haltersweb
span, or having display: inline)
Highlighted by scootermac315
width and height trigger hasLayout in IE 5.x and IE 6 or newer in quirks mode only
Highlighted by scootermac315
width, height (to 'auto')max-width, max-height (to 'none') (in IE 7)position (to 'static')float (to 'none')overflow (to 'visible') (in IE 7)zoom (to 'normal')writing-mode (from 'tb-rl' to 'lr-tb')Highlighted by bradblog
Highlighted by kenyth


Public Comment
on 2006-08-26 by bluecockatoo