Web Design |
whole page layout |
||||||||||||||||||
main menushelp pagesprinter-friendly/text-only version |
Tables are a good example of how HTML has evolved through people exploring the creative possibilities of tags. The original intention of table tags was merely to produce tabulated text. But because <td> tags could include other tag types, such as images, and have different background colours and widths, all sorts of new possibilities were opened up that designers eventually began to explore. The lecture discussed good and bad web page layout and dealt with issues such as flexibility and consistency. These topics will not be covered again here. Rather, this page simply presents a demonstration of how you can use a table to lay out a page and by extension (through applying the consistency axiom and building a template) a whole site. The site I use is this one. Every page of this site is laid out in the same way, and I am going to show you the skeleton structure of each page. I say "skeleton" because there are a lot of tags omitted from the sample below. You will also need to look at it in conjunction with the relevant style sheet entries, which are included beneath the screen shot at the bottom - these will clarify the exact effect of the various class attributes you can see in the code. Each important section has been given a reference, which applies to the screen shot below. I know this looks complicated, but it really is just a 3 × 2 table. Remember that the best way to work these things out is to ignore table content and style as much as possible, and concentrate on working out the table structure by focussing only on the <table>, <tr> and <td> tags.
You can't fully understand how this works without looking at the style sheet entries for the relevant tags, so here they are:
table { width: 100%;
border-style: none;
padding: 15px; }
td.leftcolumn
{ width: 33%;
margin-left: 5px; }
td.separator
{ width: 1%;
background-image: url(separator.jpg);
background-repeat: repeat-y; }
The background image stuff in td.separator won't mean anything to you yet but at least you can see here the use of various widths and some margins and padding. Although it seems complicated, using tables to lay out a whole page like this is a design technique which imparts a sophistication to your site, particularly if you can use it on every page. I hope this page hasn't scared you off too much; do keep trying to work out what I'm doing in the code, concentrating, if you can, only on the table structure tags (e.g. <table>, <tr> and <td>). I strongly recommend at this stage that you at least try to lay out a page using a table, converting one of your existing simple pages if need be. You only learn web design by practising it; and you now know enough about tables to do some quite sophisticated things with them. |
Material on this site is © Drew Whitworth, 2005 Permission will usually be given to reproduce material from this site for non-commercial purposes, if credit is given. For enquiries, e-mail Drew at andrew [dot] whitworth [at] manchester [dot] ac [dot] uk.