[thelist] Vertically Centering Tables

Nebula Nebula at Planet-Nebula.com
Mon Feb 17 12:44:00 CST 2003


Hello.  I'm making a webpage where the content should be in the middle
of the browser viewing area (centered vertically and horizontally).  I
am trying to keep this standards compliant.  Here's my problem:

I achieve this by having a table like this:

----------
<table border="0" width="100%" height="100%">
 <tr>
  <td align="center" valign="middle">*content here</td>
 </tr>
</table>
----------

This achieves what I want perfectly when viewed in IE.  However, since
Mozilla is standards-compliant, it doesn't even look at the "height"
attribute of my table tag.  The W3 Validator also yells at me, saying
"height" isn't even an attribute.

My question is:  There's gotta be a way you can do this in HTML, and
have it validate.  I tried altering the table's style sheet, removing
the 'width="100%" height="100%"' and giving it a class, then in my .css
file, adding the class with height:100%;width:100%.  Again, this works
fine in IE, yet not in Mozilla.

Suggestions, anyone?





More information about the thelist mailing list