[thelist] RE: How does "Box-in-a-box" hack work?

John.Brooking at sappi.com John.Brooking at sappi.com
Thu Jul 15 12:08:53 CDT 2004


Thanks to everyone who responded yesterday. I think my key misunderstanding
was that I was under the impression that both boxes had an explicit width
set, which appears not to be true. I played around with it a bit last night
and got a working demo[1].

I realized along the way that what I hinted at yesterday seems to be true,
at least for me, that this hack encourages one to think about widths on
terms of the broken IE box model instead of the true W3C standard one. This
is because the width you set on your outer DIV represents the width of your
eventual content plus padding and borders. Then your inner DIV expands the
box width to match the outer DIV, and, if it has padding and border,
contracts the content width by the amount of them. This is just like using
one DIV with the IE non-standard model! To make things worse, it actually
seems more intuitive to me than the W3C standard, probably because the
stated width and the area shaded to the outside border coincide. Maybe this
is what led the Microsoft developers astray to begin with. But is it a good
thing, long term, to train yourself to think the "the wrong way"? Will we
all have to make a big adjustment to our thinking someday, when all the
browsers in use finally adhere to the W3C standard? (True, we could still
keep on using the hack anyway, but that will certainly become gauche
someday, like using tables is today!)

Having said this, I'll probably do it anyway. Open to comments.

[1] http://www.shoestringcms.com/LayoutTest/boxModelExplain.html

John Brooking, Application Developer
Sappi Fine Paper
South Portland, ME, 04106 USA
-- 
 

This message may contain information which is private, privileged or
confidential and is intended solely for the use of the individual or entity
named in the message. If you are not the intended recipient of this message,
please notify the sender thereof and destroy / delete the message. Neither
the sender nor Sappi Limited (including its subsidiaries and associated
companies) shall incur any liability resulting directly or indirectly from
accessing any of the attached files which may contain a virus or the like. 


More information about the thelist mailing list