Geeks With Blogs

Scott Kuhl Warning: I may have no idea what I am talking about!

Occasionally designers may want to center content in a web page and they want it centered both horizontally and vertically. The traditional method for doing that is to put the content into a table and to assign a values of 100% to the table's HEIGHT attribute and center to the ALIGN attribute. Recently, that approach has become more problematic.

You may have used this before and had it work but now, for some reason, new pages you create won't center vertically. You may be changing pages from standard HTML to XHTML and now tables don't respect the 100% HEIGHT attribute. Read on.

There are a few things you need to know here. There is not now, nor has there ever been a HEIGHT attribute for tables. Scour the HTML specifications and you will not find HEIGHT among the attributes for the table tag. The fact is, table height is invalid code. If you attempt to validate a page where you have assigned a height to a table, it will fail. Assigning a height to the table tag is not the answer. You can, however, legally assign a height using CSS.

Read 100% Table Height

Posted on Monday, April 24, 2006 6:54 PM Web Design | Back to top


Comments on this post: 100% Table Height

# re: 100% Table Height
Requesting Gravatar...
Having fun with your site
Left by Cosmas Arumala on Aug 29, 2008 4:16 AM

# re: 100% Table Height
Requesting Gravatar...
I developing a site and having problems with setting the height of a table to the height of the page. I'd be grateful for your assistance. Thanks
Left by Cosmas Arumala on Aug 29, 2008 4:18 AM

# re: 100% Table Height
Requesting Gravatar...
If this article didn't help try this one:

http://www.xs4all.nl/~peterned/examples/csslayout1.html
Left by Scott Kuhl on Aug 29, 2008 7:33 AM

Your comment:
 (will show your gravatar)


Copyright © Scott Kuhl | Powered by: GeeksWithBlogs.net