473,771 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2545
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
6083
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 parameter to the xslt file. When I select a value from the drop-down list nothing appears. I want just a basic listing of Title, Image, and Description outputed. I have done a basic JavaScript that uses the .write() function and that worked so the...
2
3406
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 happening when I put my XML files and the .xsl files on my ISP's system for my home page. If I try to open the XML files in Netscape 7.0 on my own machine (ie, not on the ISP's system), the pages convert file and the result is displayed in HTML.
3
2478
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 this back as XML and render it in to an HTML table. I have all this working and all the files are below. I would value any feedback. A simple example of the data looks like this:
5
4572
by: Alec S. | last post by:
Hi, Can EMs be used for positioning? For example: #navbar { left: 2em; top : 1.3em; }
13
9650
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 assigned to a variable and output using document.write. (Note, there is no submit button or other form elements. Basically
7
18925
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 = "absolute"; t.style.left = "100px"; t.style.top = "100px"; t.style.width = "200px";
6
6082
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.5.0.2 and Opera 9.0 build 8367. Firefox 1.5 and Opera 9 will just ignore the CSS declaration
1
1672
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 under each DSLAM entry and would hence like to group in a hierarchy all such Ports under each of these DSLAM entries as shown below.
4
3472
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%" border="0" cellpadding="0" cellspacing="0"> <tr height="100"> <td width="20%" height="114">abc</td> <td width="80%">def</td>
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10102
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.