Forum Moderators: not2easy
In IE, I'm able to set width: 145px; border: 1px solid #000000; and I get exactly what I'm looking for. However, Mozilla/Firefox render the inside area as 145 pixels wide and adds the borders to the outside of it, creating a box with borders that is 147 pixels wide.
Is there any way to get what I'm looking for without doing browser detection and altering the width?
Thanks!
You may be able to get around this by placing one div in another and setting the border and padding of the outer div to 0px. Setting the width of the inner div to 100% might then work - maybe (I've been thinking about trying this).
Changing the DOCTYPE will affect this - IE 6 behaves correctly with DIVs in standards mode (I think) but frames are another story.
I try very hard to avoid these issues altogether.
Kaled.
Which one you use is a matter of personal preference. Some designers prefer not to use hacks in their CSS. Others don't like adding extra <div>s (which nested boxes requires) to their source code. Some require that the CSS validates (the Underscore hack, for instance, will not; Tan and Tantek will).
Personally, I've always used the Tan Hack, but I'm in the process of switching over to using IE Conditionals to deliver the necessary IE browsers an entirely different stylesheet. Again, it's all a matter of preference.