Forum Moderators: open

Message Too Old, No Replies

Compatibility issue with Netscape

How to center vertically a page in Netscape?

         

dnimrodx

7:19 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



Hello

I have a minor problem with the site I am working now. It is about compatibility.

I have always tried to make every site I develop compatible both with IExplorer and Netscape. It happens that this time I have to absolutely have the page vertically centered in the client area of the window which is done by a function called every time the onResize event is triggered. To accomplish this with IE I could do something like:


document.body.topMargin = (document.body.clientHeight - document.all.pagebody.scrollHeight) / 2;

but the problem with Netscape is it does not accept the scroolHeight property above used. Please note that: scrollHeight returns the height of the client area; topMargin defines the top margin in pixels (obvious, I know :) , but I feel I should include these notes anyway...); clientHeight is related to the total height of the client area on which the page is displayed; and pagebody, which is the ID of the main table in my page.

Does anyone has a sugestion that could solve this?

Thanks alot,

D Nimrod

DrDoc

9:25 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

I would suggest using CSS for centering the page :)

dnimrodx

1:37 am on Jan 29, 2004 (gmt 0)

10+ Year Member



Thanks Doc, you were very helpful.
Indeed you were right. I must use CSS if I want to maintain compatibility!

And thanks for the welcoming.

D#Nimrod

ram_mac

1:39 am on Jan 29, 2004 (gmt 0)

10+ Year Member



see also:

[webmasterworld.com...]

dnimrodx

2:06 am on Jan 29, 2004 (gmt 0)

10+ Year Member



ram_mac you were very helpful!
Thanks a lot! I do not have to use onResize_event anymore as that CSS trick that you showed me (which I did not knew about) will do the trick!

Thanks a lot!

d#Nimrod

ram_mac

7:40 pm on Jan 29, 2004 (gmt 0)

10+ Year Member



I didn't even know about it until a couple of weeks ago - rather a clever, and simple solution to a long standing problem.

Suppose I should stick the link to the page here as well really (two threads on the same topic at the same time):

[wpdfd.com...]

dnimrodx

10:53 pm on Jan 29, 2004 (gmt 0)

10+ Year Member



It is indeed a rather clever simple solution which is preferable to some (heavy) lines of coding.

Hail CSS!

BTW: thanks for the input ram_mac