PDA

View Full Version : centering tables hor and vert! HOW?



leroy
September 7th, 2001, 04:58
i wonder if anyone could give me tips on how to centre a table verticle and horizontal on resize of the browser. if this is not clear this http://www.mathmos.com uses it. what is the code please?

meow
September 7th, 2001, 05:13
Hi!
Is it NS4x you are having trouble with? There's some JavaScript hack to make the page reload on resize, but I can't find it now. Sure someone else will. Your page centers perfectly for me though (IE5, NS4.5).

Boy, are you good with graphics! You've made those GIFs look like Flash. Nice. :)

LastActionHero
September 7th, 2001, 05:55
Dreamweaver generates the following script to fix the netscape bug. Put it between <head>and</head>



<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

leroy
September 7th, 2001, 08:03
Originally posted by meow
Hi!
Is it NS4x you are having trouble with? There's some JavaScript hack to make the page reload on resize, but I can't find it now. Sure someone else will. Your page centers perfectly for me though (IE5, NS4.5).

Boy, are you good with graphics! You've made those GIFs look like Flash. Nice. :)

thanks but i did not do this site. i need to centre my table like this http://www.mathmos.com

meow
September 7th, 2001, 08:41
Oops. My bad. Well, use an outer table. The following isn't totally "legit" but should work:



<center>
<table border="0" height="100%">
<tr>
<td align="center" valign="middle">

>> YOR REAL TABLE HERE <<

</td></tr></table>
</center>