HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Table alignment
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table
View previous topic :: View next topic  
Author Message
speaky



Joined: 01 Jul 2004
Posts: 5

PostPosted: Thu Jul 01, 2004 2:31 am     Table alignment Reply with quote

Hey,

I have laid out my web site using tables and was wondering if anyone knew how to center the table vertically?

I have set the table up with align="center" to center it horizontally on the page but the table is at the top of the browser...

Can anyone help?
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8199
Location: Castle Rock CO USA

PostPosted: Thu Jul 01, 2004 3:53 am     Reply with quote



You could try valign="middle"
speaky



Joined: 01 Jul 2004
Posts: 5

PostPosted: Thu Jul 01, 2004 5:02 am     Reply with quote

I've tried that and it only seems to move the page from left to right not up and down the browser window?!?!

Is it possible to align the table this way?
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8199
Location: Castle Rock CO USA

PostPosted: Thu Jul 01, 2004 5:41 am     Reply with quote

Can you post some of your code / or an URL? I think I understand what you want to do - but if I could see what you have done - it would help.

Otherwise I think you might be trying to do something like:
Code:
<table border="0" width="100%" id="main" cellspacing="0" cellpadding="0" height="100%">
   <tr>
      <td align="center">
      <table border="0" width="90%" id="content" cellspacing="0" cellpadding="0">
         <tr>
            <td align="center" width="90%">&nbsp;</td>
         </tr>
      </table>
      </td>
   </tr>
</table>
mjpliv



Joined: 11 May 2004
Posts: 406
Location: Nova Scotia

PostPosted: Fri Jul 02, 2004 3:52 am     Reply with quote

To use VALIGN=CENTER you have to pre-determine the height of your page by enclosing it inside of a table. Unless you limit a page height some way then the HTML has no way of knowing where the vertical "center" is.

Once you have created an all encompassing table then the table you are trying to center can be manipulated as table data. In this example I used 100% of the available space for the encompassing table size -

Code:
<html>
<head>
<title>Nested Tables Example</title>
</head>
<body>
<table width="100%" height="100%" borders=0 cellpadding=0 cellspacing=0>
   <tr>
       <td width=100% align=center valign=center border=1>
           <table width=450>
                <tr>
                    <td width=150 align=center>Table Stuff Here</td>
                    <td width=150 align=center>Table Stuff Here</td>
                    <td width=150 align=center>Table Stuff Here</td>
                </tr>
                <tr>
                    <td width=150 align=center>Table Stuff Here</td>
                    <td width=150 align=center>Table Stuff Here</td>
                    <td width=150 align=center>Table Stuff Here</td>
                </tr>
                <tr>
                    <td width=150 align=center>Table Stuff Here</td>
                    <td width=150 align=center>Table Stuff Here</td>
                    <td width=150 align=center>Table Stuff Here</td>
                </tr>
             </table>
          </td>
       </tr>
</table>
</body>
</html>


which produces this page -

Http://www.buildersmatrix.com/info/nestingtest.html
speaky



Joined: 01 Jul 2004
Posts: 5

PostPosted: Wed Jul 07, 2004 5:45 am     Reply with quote

Cheers, got it sorted now... (",)
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Webmaster Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial