I thought I'd create my own thread on the subject of using tables for full page layouts.
here's my example
The above code gives a full page table. If the DOCTYPE is changed, it may not render it in as a full page, but with with the one here it will.Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Tables with CSS for layout</title> <META http-equiv="content-type" content="text/html; charset=UTF-8"> <style type="text/css"> body {padding:0px;margin:0px} thead { height:auto;background:yellow;margin:0px } .ltd { width:100px;background:red; } .mtd { width:auto;background:green; } .rtd { width:100px;background:blue; } tfoot { height:auto; background:purple;color:white } td { padding:0px;border:0px;margin:0px } table { height:100% } </style> </head> <body> <table cellspacing="0"> <thead><tr><td colspan=3><h1>Header</h1></td></tr></thead> <tfoot><tr><td colspan=3>footer</td></tr></tfoot> <tbody> <tr> <td class="ltd">left content left content left content left content left content left content left content </td> <td class="mtd">middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle contentmiddle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle content middle contentmiddle content middle content middle content middle content middle content </td> <td class="rtd">right content right content right content right content</td> </tr> </tbody> </table> </body>
It is html and css validated.
For SEO, you may want to create a common footer in an external js file, as the <tfoot> must go between the <thead> and <tbody>
Otherwise search engines will probably pick up just links ( that's what most people put in their footers ) before the content, but SE's prefer to find links written within text.
so a good way of using this script is to also use the following.
remembering to allways put it between your thead and tbody tags.Code:<tfoot><tr><td colspan=3><script type="text/javascript" src="commonFooter.js"></script></td></tr></tfoot>
As tables render well when text size in changed within the browser, the objects within each <td> can be applied with widths of 100%. Using this method pictures and menus will render well when text size is increased.








Bookmarks