[thelist] Help with DIV problem

Sarah Sweeney mr.sanders at designshift.com
Tue Jun 8 09:18:02 CDT 2004


Seyon wrote:
> Message from Joshua Olson (6/7/2004 04:11 PM)
>> Sandra,
>>
>> I think the problem may lie in that you've broken what I consider the
>> cardinal rule... never EVER put a set width on a div if you also 
>> specify any
>> of border, padding, and margin.  You broke that rule in the following 
>> three
>> rules:
>>
>> <snip>
> 
> I think that's a pretty horrible cardinal rule to foist off on others. 
> It probably simplifies life for you but it doesn't really address the 
> reason why problem occurs - that width+margin+padding+border is computed 
> differently by different browsers.
> 
> Properly understanding that makes it quite obvious that a width can 
> indeed be specified so long as you leave sufficient "margin of error" 
> space instead of making them all add up to precisely 100%.

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. This way my code is cleaner and more "forward 
compatible" - I think it will be easier (when the time comes that 
browsers handle the box model the same*) to remove the hacks from my CSS 
than to go through all of my HTML removing extraneous nested DIVs. Is 
using nested DIVs really any better than using nested tables, especially 
if the only purpose is to make your design work?

* 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? :)

-- 
Sarah Sweeney
Web Developer & Programmer
Portfolio :: http://sarah.designshift.com
Blog, etc :: http://hardedge.ca


More information about the thelist mailing list