Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centring a web page

Status
Not open for further replies.

relisys

Programmer
Mar 6, 2003
65
GB
Hi guys (and gals)!

I have a website which fits into a table so that i can centre it automatiaclly. However, I want to centre it both vertically and horizontally, so that no matter what resolution the site is viewed in, (especially the higher resolutions) it appears centred in the browser window.

Can someone give me any pointers or direct me to a site so that I can quickly and simply do this. I'd prefer not to use frames if possible, but if thats the only method then it'll have to do!

Cheers!

Relisys
 
I have a page i was trying to do that with.

It's at
Hard to tell on a 800 x 600 screen but this page will center horizontally and vertically on any screen size.

Take a look at the source code to see how i did it. One very important thing is the doctype. The page MUST use the HTML 4.01 transitional doctype. If i change this same page to the HTML 4.01 strict doctype, it won't center vertically.
 
Wiser -

can you check that URL - seems to be wrong!

Cheers!

Relisys
 
<table width=&quot;100%&quot; height=&quot;100%&quot;>
<tr>
<td width=&quot;100%&quot; valign=&quot;middle&quot; align=&quot;center&quot;>
Content
</td>
</tr>
</table>

-Volkoff007
 
cool - any way of doing it with frames which auto size so that its centred?

Cheers!

Relisys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top