[thelist] hasLayout triggering & best practice

Barney Carroll barney.carroll at gmail.com
Fri Dec 3 09:24:21 CST 2010


Hi folks, bit of philosophy & CSS for y'all.

A recent project faced a series of late-noticed serious IE6 hasLayout bugs,
and got the team in a panicked discussion in which IE6 bug-fixing best
practice got discussed. I ended up re-reading Ingo Chao's excellent article
'On having layout' http://www.satzansatz.de/cssd/onhavinglayout.html, but
still ended up with a few questions. I was wondering if thelist's CSS
experts might venture answers to these questions:


   1. Could it be argued that *any* layout (necessitating complex
   absolute/relative positioning, overflows, nested lists, etc), carefully
   built with a thorough knowledge of the Trident box model in mind can avoid
   having to artificially trigger hasLayout? In other words, no matter how
   complex a layout's requirements, if it does for whatever specific causes end
   up suffering from mis-positioned or invisible content due to hasLayout,
   could I safely say that it should be able to be constructed without
   resorting to otherwise spurious hasLayout triggers?

   2. Ingo's article repeatedly alludes to the classic MS-proprietary CSS
   zoom:1 trigger being acceptable 'for debug purposes', implying that it
   should be used to help diagnose hasLayout issues but not to treat them in
   production. But then concludes that it may be necessary for IE7, but IE5.5-6
   should instead use height:1%, even though this is obviously a hack in the
   sense that it abuses a property for ulterior purposes (unlike zoom, which
   only affects hasLayout), and will have disastrous effects on any element
   whose parent also has a set height or non-static positioning. Is it
   reasonable to assume that this, along with the article's stated preference
   for conditional comments (rather than CSS syntax-based browser targeting),
   are purely down to a distaste for invalid CSS? I'm not particularly
   interested in the legitimacy of that distaste — but I would be interested if
   there were other reasons I may be missing.


Regards,
Barney Carroll

barney.carroll at gmail.com
07594 506 381


More information about the thelist mailing list