SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Centering content

    Hi,

    for my index page, I have a table with 2 columns. What i wanna do is center the table both horizontally [i can do that] and vertically.

    I dont really know how to make the table appear in the middle of the screen.

    My search on this forum came up with mostly centering popup windows...

    Do you guys get what I'm trying to say here? Help me out on this .

    thx
    asT.

  2. #2
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The 'Height' ttribute is buggy so you'll probalby have to use CSS margins. Try something like this for a start.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    #content {
    	margin:20% 20%;
    	text-align:center;
    	border:1px solid red
    	}
    </style>
    </head>
    
    <body>
    <div id="content">
    
    				<table width="300" border="1" cellpadding="0" cellspacing="0">
                    		<tr>
                    				<th scope="col">&nbsp;</th>
                    				</tr>
                    		<tr>
                    				<td>sdfsdfsdf</td>
                    				</tr>
                    		<tr>
                    				<td>&nbsp;</td>
                    				</tr>
               		</table>
    </div>
    
    </body>
    </html>
    Adjust the margin percentages according to the content inside the main DIV.
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ::: certified wild guess :::

  4. #4
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    awesome stuff guys. worked perfectly

    thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •