na****@ctip5ei.ih.lucent.com (J. Potts) wrote:
Just out of curiosity, has anyone run into this problem? Someone where
I work put a set of pages together with the following in the style sheet:
BODY { position: absolute;
margin-top: 0mm;
margin-left: 0mm;
margin-right: 0mm;
border: 0mm;
padding: 0mm;
border-width: 0mm;
left: 0mm;
right: 0mm;
top: 0mm;
}
What a strange stylesheet.
mm are very rarely a useful unit on the web (marginally useful in
print stylesheets, totally useless in screen stylesheets).
Zero lengths don't need units at all.
There's no need to set margins, especially zero margins, on absolutely
positioned elements.
The page displays correctly for Netscape 4.7
Indeed. This hack is one way of getting rid of the default page
margins in NN4. For those people who still bother trying to make pages
pixel identical in NN4 and modern web browsers.
and 7 as well as IE 6. The
problem is if you go to print the page up from Netscape 7. Only the first
page will print. I did a little experimenting and discovered that if you
remove "position: absolute;" from the body element, then Netscape 7 will
correctly print all pages.
Hmm, I can sort of see what's happening. By setting position: absolute
on body you're attaching the body to the semi-mythical root element.
On screen this root element is the browser window (sort of, browsers
vary on how the relate the root element, the html element, the body
element and the browser window) but when printed the root element
could be the page. So maybe the body is being attached to the first
page and when it doesn't fit the excess is not printed on subsequent
pages. Or I may be talking out of my arse.
I was wondering if there were some guidelines for how and when
"position: absolute;" should be used. I've typically only seen it used for
images, divisions or other sub elements within a body, not as part of
the body style.
The best advice is that absolute positioning should be used with care.
Frankly, I can't see what benefit it adds to the body element.
Apart from the above mentioned NN4 hack there are also a few hacks
involving absolutely positioned bodies that work around shortcomings
in IE's CSS support (e.g. to simulate position: fixed;).
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>