[thelist] Help with DIV problem

Joshua Olson joshua at waetech.com
Tue Jun 8 09:57:01 CDT 2004


> -----Original Message-----
> From: Sarah Sweeney
> Sent: Tuesday, June 08, 2004 10:18 AM

> Personally, I prefer to set widths, margin, padding, and borders where I
> need them, without using nested DIVs, and use CSS hacks if necessary to
> make sure that the page I'm developing looks (pretty much) the same
> across browsers.

Sarah,

Agreed 100%.  Difficulty comes when the units are not always the same.  For
example, if the width is a percentage, and the padding, margin, and border
are something else (perhaps em or px) then things get really ugly, really
fast.

Rounding discrepancies for % calculations also lead to issues.  For example,
if you have 2 divs both set to 50% width in an attempt to have 2 columns
using floats, what happens when the container is an odd number of pixels
wide?  On some browsers it'll wrap because the aggregate width of the divs
is 1 pixel too wide, on others it won't... it all depends on how the
rounding happens.

My "cardinal" rule of thumb is an over simplification of the situation, but
is useful nonetheless.  If a person can indeed calculate 100% because they
know all the units involved, then they don't need to bother with the rule.
This is usually only the case in fixed designs that are "pixel perfect".
For CSS newcomers I suggest the rule, and label it as "cardinal", to save
them time and headaches.

As any veteran will tell you, cardinal rules don't necessarily apply to the
old and wise.  :-)

> * Maybe I'm being too optimistic in thinking that the box model will
> someday be implemented consistently across browsers, but a person can
> hope, right? :)

I hope you are not being too optimistic, indeed.  But I fear that
standardization won't come about until MS embraces a new rendering engine
for IE... Mozilla would be a nice candidate.  They'd have to through in a
huge number of proprietary extensions to make it backwards compatible for
some legacy web applications, but that shouldn't mess with the rendering.
But honestly, I don't think they will in the next few years.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168




More information about the thelist mailing list