Forum Moderators: open
My question is this. Must I include </DIV> at the end of the page or is it closed by the </BODY> tag? IE, Opera and FF all render correctly if I omit the </DIV> tag.
Obviously, to be safe I must include the final </DIV> but for reasons I don't want to get into, I'd like to omit it. Can anyone give me a definitive answer?
Thanks
Kaled.
But if you are already not writing valid code, why worry about that one div? The error correction that the browsers have seem to know what to do with it.
The reason for using a DIV for the whole body is that I'm placing a banner across the top of the screen using position:absolute. Firefox is ok with this but Opera and IE both calculate the width incorrectly if body margins are non-zero.
To make it more complex, I'm using both frames and iframes depending on whether javascript is enabled - Yikes!
Kaled.
Opera and IE both calculate the width incorrectly if body margins are non-zero
Just a thought -
You might experiment with a rule that gives the <html> element (senior to the <body> element!) some padding rules. Those rules, it the problematic browsers apply them, could replace any <body> margin rules you found necessary, and maybe get around the absolute positioning problem you tripped over.
I agree that with current browsers an unclosed "global" <div> is unlikely to run into rendering problems because of error recovery - however I would check Mac IE5 and Safari before going forward.
However, you never know about the future browser versions (such as the upcoming IE update.) Valid mark-up is one of the best ways to future-proof your website, so I would definitely give some thought as to how that can be accomplished with your layout's needs.