What elements do have layout? Elements that have layout include: bodytable, tr, td, input, select, textarea, button, img, marquee, hr, inframe(don't use this, please :) ), object, applet
How to give layout to an element? Using one of these CSS properties: float: left/right; position: absolute; display: inline-block; width/height;
Problems caused by "layout": Elements with layout incorrectly size themselves: Let's say you have a div with width:10px; Write some text inside it and set it's size to 30px. Also set border: 1px solid black; In this situation the text should flow out of the div, but in IE the div incorrectly expands. This shows that IE uses width like a min-width.
Absolute positioned elements within a relative container: Let's say that you have some absolutely positioned elements inside a relatively positioned ancestor. In IE, instead of being positioned relative to the ancestor, these elements will get positioned relative to the viewport. This bug is caused by IE's internal "hasLayout" feature. Elements with relative position are not considered to have "layout". A simple solution for this bug would be to set a width or height, to force the element to have layout. Anyway, maybe sometimes you will not know the dimensions of the element, so you can use the following hack:
/* Hide from Mac */
* html.element {
heighT: 1px;
}
/* End hide from Mac */
About Author :
Lighezan Alexandru is a high quality web development articles writer. Some of its work can be found at chml srucnoc online.