Forum Moderators: open
I have since found out that NS 6 is infact the one that is correct and that MSIE is wrong. By adding <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> and resizing the layers I found that NS6 and MSIE 6 became identical in the layer's pixel coverage.
However, in MSIE5 the layer then shrunk.
Could anyone suggest a solution which would allow padding and also match these 3 browsers. I doubt it, but there might be a possibility so I'll still ask. Hope you can help.
Googly
Remember a couple of years ago? It was almost mandatory to use a handful of different hacks to make the page look the same, or at least ok, in most browsers. Today we've learned to avoid HTML hacks. Most Web developers uce valid HTML when coding, combined with CSS.
Sure, now we've realized that not all browsers understand CSS the same way. Naturally there are several ways to find our way around those bugs. We can, for example, avoid the certain rule that causes problem. Or, we can create a less strict layout, one that doesn't require pixel perfection, and is therefore more fluid. Or, as a last resort we can try to find a hack or similar workaround.
Again, personally I prefer the second option - to create a more forgiving layout. It is, using hacks or not, almost impossible to make it look the same. And, even if that look is acheived .. then we've only been able to target the five or so most common browsers. What about the others?
Finally, if a hack has to be used (and I'm using the word "hack" as a very general and broad term, meaning any kind of standard-wise unnecessary workaround) .. the hack should always validate. If a hack or workaround validates, then you can be almost sure it won't cause any problems in the future, and that it won't affect unknown browsers too dramatically. Still, it's better if it can be avoided entirely.
We really don't want to start using a handful of hacks for each browser again, do we? ;)
Yes.
>Remember a couple of years ago?
Generally, yes. :) In terms of css and html, no.
> Again, personally I prefer the second option - to create a more forgiving layout.
I agree, ive never made a layout that couldnt cope with a slight nudge here and there, and i have never employed this particular technique to workround IE5 issues. However I remembered seeing it described once and thought i would throw it into the mix as an option. thats all.
ben
You're right in that the IE5 CSS box model is in fact broken. IE6 emulates it if you don't set your DTD properly. There is a very ugly (in terms of how it makes your stylesheet work) workaround for this problem here:
[glish.com...]
I don't know if this validates or not (I doubt it) because I'm too hardheaded to hack my code to accomodate for bad parsing code.
::Add::
This is the Tantek box-model hack. Feel free to flog me. Or destroy the link.
He said to me:
"A lot of folks use hacks for the box model, but I prefer using proprietary Microsoft conditional statements (hair of the dog :?-). Put this below all other style sheets in your <head>
<!--[if IE 5]>
<link href="ie5boxhack.css" rel="stylesheet" type="text/css">
<![endif]-->
Then, in ie5boxhack.css, enter the curative dimensions :-)"
Well, after a bit of playing around, my test page is now pixel perfect to a high degree in MSIE 5.x and 6 and NS6 and hopefully 7, which is great!
Any thoughts?