Forum Moderators: open

Message Too Old, No Replies

How do I center my web page at any resolution?

         

new2web

5:57 pm on Apr 9, 2009 (gmt 0)

10+ Year Member



I have built a website using coolpage, using there cut and paste softwear and although it's not to everyones taste it
seems to look ok. The only problem is how do I center the page so it is centered in the middle of the screen at any resolution.I looked at some of the responses you guys have given but the htlm coding you use does not seem to make a differance when I add it to the source code of my webpage.
If you want to look at the source code, so that you can help then please advise as I have just been kindly told to remove the url of the site in question as I did not know there was a ruling on this.
Any way to sort this please guys
thanks
new2web

[edited by: new2web at 6:43 pm (utc) on April 9, 2009]

LifeinAsia

6:03 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Weolcome to Webmaster World! [webmasterworld.com] Please don't post urls to your sites- the mods will likely remove it.

If you use an absolute positioning, then it's not going to center it. Absolute positioning is, as the name implies, absolute. So it will be absolutely the same position regardless of the browser size.

If you want it centered, the easiest was would be to use <div align="center">.

new2web

6:15 pm on Apr 9, 2009 (gmt 0)

10+ Year Member



Hi Thanks for your reply I am new here so did not realise about posting my url sorry, is there anyway I remove it as I don,t want to get in any trouble?
I am very new to this so is it possible for someone to take a look at my source code and to show me where to put the <div align="center"> as I tried that and it is still the same.
Best Regards
New2Web

LifeinAsia

6:23 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Click on the "owner edit" link under your name to the left next to your post. I'm not sure what the time limit is for editing.

The problem is that it looks like most of your DIVs use absolute positioning. That will override any centering you may have elsewhere.

new2web

6:42 pm on Apr 9, 2009 (gmt 0)

10+ Year Member



Thanks LifeinAsia, I removed the url, have you any idea how I can solve this please.
Best Regards
New2Web

CSS_Kidd

6:44 pm on Apr 9, 2009 (gmt 0)

10+ Year Member



If you know some things about css then you would be able to center it with no problem. However I would have to see your code to see what kind of issue you are having. Also what browser are you looking at it in. make sure you check it in every browser (I check mine in IE6 and up, Firefox, Opera and safari). So please reply and post your code as well and one of us if not a few will point you in the right direction.

LifeinAsia

6:57 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



have you any idea how I can solve this please.

Removing the absolute positioning in all the other DIVs will help.

rocknbil

9:01 pm on Apr 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<div align="center">

I'm shocked! :-)

align="center" is a deprecated attribute and will not validate in strict doctypes; use

<div style="width: 90%; margin:auto;">

Post a BASIC outline of your code - that is, reduce it to it's basic framework that illustrates the problem, and someone will be able to help you here.

Previously posted by SuzyUK, if you also want vertical centering, Dead Centre [wpdfd.com]