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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centre Table on page

Status
Not open for further replies.

Copierbw

Technical User
Sep 25, 2002
112
IE
Is there a way to centre a table horisontally and vertically on a page no matter what size the client screen is set to ex 800X600 or 1024X768. I want the table or contents to be in the centre(V and H) of the screen always?
 
This is possible, but only with some invalid markup (height is not a supported attribute in the HTML4.01 specifications, so its usefulness is seriously limited):

<table width=&quot;100%&quot; height=&quot;100%&quot;>
<tr>
<td align=&quot;center&quot;>
<table>
<tr>
<td>Your content goes here</td>
</tr>
</table>
</td>
</tr>
</table>

<table border=&quot;0&quot; width=&quot;100%&quot; height=&quot;100%&quot;
cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;100%&quot; height=&quot;100%&quot;>
Your content goes here
</td>
</tr>
</table>

The above will put a 1 cell table 100% horizontal and vertically

It works with Internet Explorer, Netscape Navigator 4.x and Opera.

Netscape Navigator 6 and Mozilla only support W3C recommendations so those browsers will ignore the &quot;height=100%&quot; attribute and you'll lose vertical centering.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top