15

I've read some article on it but didn't get what is actually. can anyone on SO explain me.

Is it only related to IE6 only?

What does zoom:1?

Is layout is a IE only TAG?

Edit:

I found this info very informative for me

Because Internet Explorer is so old (as it was one of the first browsers available), it hasn’t had the luxury of starting anew as current browser do. So as time went by, Microsoft began adapting new engines to make use of CSS. Seems fine… However, CSS changes the fundamental assumption that Internet Explorer’s engine is based on – that anything significant is a rectangle that contains all its content.

So to deal with the new standards of CSS, Microsoft decided to fix their ancient engine by implementing the hasLayout property, instead of rebuilding IE. Every element in Internet Explorer now has a hasLayout property. Depending on the element, it is set to either true or false by default. If hasLayout is set to true – the element is an independent box that is responsible for rendering itself. If false – then the element relies on a parent element that has hasLayout set to true to render it. This is where a majority of IE bugs come to life.

source: http://bytesizecss.com/blog/post/fix-haslayout-with-one-line-of-css

I found one more discussion here also : http://www.molly.com/2007/03/30/back-to-work-someone-please-clearly-articulate-haslayout/

11

1 Answer 1

15

It's a non-standard property on an HTML element which is only supported by IE7 and lower ( IE8 compatability mode too ), which if triggered, causes the element to be rendered in a certain way ( which can be unexpected, random, can be a godsend or can be hell ).

Classic example is giving layout to an element so it can clear floats.

#wrapper { zoom:1; }

The element will now contain floats. Any of these properties and value other than auto/normal will trigger the layout property.

* display: inline-block
* height: (any value except auto)
* float: (left or right)
* position: absolute
* width: (any value except auto)
* writing-mode: tb-rl
* zoom: (any value except normal)

Please have a thorough read @ http://reference.sitepoint.com/css/haslayout

18
  • layout means width and height? Nov 25, 2009 at 3:07
  • 1
    1. you give an element layout by setting any of the properties listed ( those aren't all the possible ones, read reference.sitepoint.com/css/haslayout for reference ) 2. IE8's compatability mimics IE7 therefore hasLayout is on the compatability mode. 3. Right Nov 25, 2009 at 3:16
  • 1
    4. For example width:auto doesnt trigger but width:1px would. Nov 25, 2009 at 3:17
  • 1
    "height: (any value except auto)" - this means any value other than auto. Nov 25, 2009 at 3:19
  • 1
    We've already established that it's IE specific, let's forget about other browsers. Whenever you assign a property such as the ones specified, it turns it on whether you want to or not, sometimes in order to fix bugs you have to manually turn it on by specifying any of the properties and a specific value, so it's rendered differently. Nov 25, 2009 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.