Centering the page on the monitor - ANY monitor (Full Version)

All Forums >> [Web Development] >> Expression Web Help



Message


dsulvett -> Centering the page on the monitor - ANY monitor (5/8/2008 14:35:43)

Hello All;

I was wondering if someone could tell me how to have a page ALWAYS center in any web browsers (or the more popular ones)

Now, i was wondering if there was just some kind of java script line i could put into the code, or something small. For the amount of web stuff i do, i really dont want to learn CSS... im looking for a quick fix to this...

Thanks
Dave

Here is a sample www.152harrellave.com notice how it is off center!! thanks again




BobbyDouglas -> RE: Centering the page on the monitor - ANY monitor (5/8/2008 15:39:29)

You will want to remove the javascript that resizes the window when testing this..

In your HTML code, right after the <body> tag, add:

<div align="center">

and then right before the </body> tag, add </div>





dsulvett -> RE: Centering the page on the monitor - ANY monitor (5/9/2008 17:00:55)

Hi Bobby-
Thank you but either im doing this wrong or ???? when i do what you said, everything goes whacked! hmmm..can you show me an example please...

Thanks
Dave




Tailslide -> RE: Centering the page on the monitor - ANY monitor (5/10/2008 2:46:54)

You've got everything positioned absolutely which will lead to major problems.

You've also got a 225px left and right margin on the body element and other elements. Try removing that for a start. You could try one of two methods.

1. Give the body element a width (820px?) and then add margin:0 auto; Also remove the 225px margin on the inner divs.
2. If that doesn't do the trick then as Bobby says - stick a div around all the content (apart from the menu which says it has to be first) and then give that a width plus margin:0 auto plus position:relative (very important that).

The page seems to be forcing the window size which is a bad idea (not polite to say the least).

To be honest you should think about removing the absolute positioning rules as they break the page under any other conditions than those you've specified.







Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875