473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

using position attribute in body element

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;
}
The page displays correctly for Netscape 4.7 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.

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. Frankly, I can't see what benefit it adds to the body
element.

--
JRP
"How many slime-trailing, sleepless, slimy, slobbering things do you know
that will *run and hide* from your Eveready?"
--Maureen Birnbaum, Barbarian Swordsperson
Jul 20 '05 #1
1 2520
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/>
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Mark Constant | last post by:
I have a drop-down list now and I got it so when something is selected from the drop down list it calls a JavaScript function. I want it so the value selected from the drop-down list is sent as a...
2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
3
by: Sandros | last post by:
Background: I'm collecting usability statistics for a group of applications. Each count has the following attributes: date, application, major heading, minor heading, count. My intent is to pull...
5
by: Alec S. | last post by:
Hi, Can EMs be used for positioning? For example: #navbar { left: 2em; top : 1.3em; }
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
7
by: Andrew Poulos | last post by:
I'm using the following code to create a small table with one column and two rows. An image goes into the first cell. //create table var t = document.createElement("TABLE"); t.style.position =...
6
by: Gérard Talbot | last post by:
Hello fellow stylers, When trying this page http://www.gtalbot.org/BrowserBugsSection/PercentualRelativePositioning.html I get different rendered layouts with IE 6, IE 7 beta 2, Firefox...
1
by: karthikpv | last post by:
Hi, I am trying to group nodes in a huge xml file by one of the common fields. I have tried using "for-each-group" and "group-by" but am unable to get it working. Here, I have a list of Ports...
4
by: HoangTuanSu | last post by:
I have just got a javascript code from my friend. I've modified it for my purpose but a problem happens. First, here's my code html <body> <table align="center" width="60%" height="100%"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.