Tutorials & Script Homepage
HTML/DHTML 1to7
HTML - Lists
Using iFrames
Background Colours
Basic Tables
Advanced Tables
Tables Tricks 'n' Tips
Tip Boxes
advertisment
advertisement
advertisement
Host With Us: HostingHelper.co.uk From Only $5.00p/m
Spotted an Error ? Let us Know
100's more FREE templates at FreeWebTemplates
Looking for a new Web Host ?
Free templates from TemplatesLand
Professional High-End Templates
TemplateBox.com more FREE templates
Free Flash Templates and Intros
advertisement
 
HTML/DHTML TUTORIAL NUMBER : 05
Please Click Here, and Help Keep This Site FREE to Use
 
Please click on our sponsors advert to the right if you download or use anything from this page.
Thank you for your help.
This tutorial has been created by: infinite-fire.net

Advanced Tables

HTML Tutorial - Advanced Tables
In this tutorial you will learn how to 'nest' tables and format cells using html for use in your web design.

Nesting Tables
Nesting? what's that? Basically its putting tables inside other tables, you remember in the basic tables tutorial i said you can put other tables inside table cells - well here's how.

<table>
<tr><td>

<table>
<tr><td>
Hi, I'm in a nested table... but its a but boring!
</td></tr>
</table>

</td></tr>
</table>

As you can see, the T able D ata is, in this case, a whole new table, albeit with only one cell in each.

Why Bother??
What's the point in nesting tables - making your job easier, for example consider the following:

HEADER IMAGE
NAV IMAGE
Home
Links
About
Portfolio
Contact
Subheadings/links
PAGE CONTENT
Copyright Information

The page is very neatly laid out, and more importantly, you can safely edit the links table and the content table without damaging the overall layout, you might also choose to put the header in a table, for example if you wanted to put more links horizontally under the header. The code for the above table is:

<table width="300" height="203" border="1" cellpadding="0" cellspacing="0" bordercolor="#990000">
<tr align="center">
<td height="30" colspan="2">HEADER IMAGE</td>
</tr><tr>
<td width="114" height="159" align="center" valign="middle">NAV IMAGE<br>


<table width="100" border="1" cellpadding="0" cellspacing="0" bordercolor="#006600">
<tr>
<td align="center">Home</td>
</tr><tr>
<td align="center">Links</td>
</tr><tr>
<td align="center">About</td>
</tr><tr>
<td align="center">Portfolio</td>
</tr><tr>
<td align="center">Contact</td>
</tr>
</table>

</td>
<td width="180" align="center">


<table width="95%" height="159" border="1" cellpadding="0" cellspacing="0" bordercolor="#000066">
<tr>
<td height="10">Subheadings/links</td>
</tr><tr>
<td align="center">PAGE CONTENT</td>
</tr><tr>
<td height="10">Copyright Information</td>
</tr>
</table>

</td>
</tr>
</table>

This may look a bit confusing, but its all quite simple - the same three tags repeated in the correct order. I have colored the code according to which table it represents, as shown in the diagram, you can ignore the extra attributes for now (bordercolor="#blah", align="blah", border="1" etc.) - they were simply used to show which tables were nested.

Basically you just have to make sure that you don't overlap tags, i.e.

<font size="6"><b>Hello World!</b></font> -- is correct
<b><font size="6">Hello World!</b></font> -- is incorrect

Checking up
The same rules apply for tables, and most errors occur when you don't close tags, to prevent this (it WILL happen, believe me!) you can either use a WYSIWYG (what you see is what you get) editor, such as Macromedia Dreamweaver , my personal favorite - these will generate the code for you, all in the right order. If you can't afford the hefty price tag of these programs, then you can get your code validated here , simply enter the URL of your page and it checks to see it complies with the W3C standards.

Formatting Cells
Those tables were all well and good... but they were a bit boring yes? To make them more exciting there are a few tags you should be aware of. To make your tables have no borders, simply add the border="0" attribute to your table tag, i.e. <table border="0"> obviously you can also make your table borders bigger - experiment! its the best way to learn!

Changing the background color of a cell
Another major formatting attribute is the bgcolor attribute, this can be defined using simple, word-based colors, or hexadecimal values, for the purpose of this tutorial i will use both.
To dictate the background color of a cell you insert the bgcolor attribute into your <td> tag, for example:
<td bgcolor="red"> -- simple word-based colors
<td bgcolor="#ff0000"> -- hexadecimal color values
both of the above will generate this:

 

if we then add the border="1" attribute, we get this:

 

now, for my last trick in this tutorial, the bordercolor attribute

 

As you can see there are many possibilities (especially with millions of possible color values)
the code to generate the above table (complete with bordercolor , border and bgcolor attributes) is shown below:

<table width="100" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#FF0000">&nbsp;</td>
</tr>
</table>

I hope this came in useful!
Ask in the forum if you have any suggestions or comments.

Web Hosting  |  Membership website templates  |  Reliable UK Web Hosting  |  dresses  |  Art Web Templates  |  Cheap Flight Deals  |  UK Web Hosting Company  |  Coursework Writing  |  Reseller Hosting  |  coches de ocasion  |  Cheap UK Web Hosting  |   cell phones  |  Web Design  |  Low Cost Domain Names  |  Website templates  |  master a distancia  |  Austin Web Design  |  Flash Templates  |  Factory  |   cell phones  |  Canadian Web Hosting  |  Flash Intros  |  Web Templates  |  cartuchos  |  Corporate Logo Design Service  |  Website Templates  |  Bespoke Software Development  |  Domain Name Registration  |  Free Website Templates  |   Dedicated Server  |  UK Web Hosting  |  Dating Software - aeDating 4.1  |  Website Templates  |  Power Saver  |  taobao agent  |  Flash templates  |  Lolita Dresse  |  china wholesale  |  Canadian Web Hosting  |   Cheap Web Hosting Deal  |  Linux Hosting  |  Web Design uk  |  Web Hosting  |  Business web directory  |  Electronics  |  Free domain names  |  Best UK web Hosting  |  Shower Enclosures UK  |  

 
advertisment
advertisment
advertisment
  Top-end templates
  Flash Templates
  Web Hosting UK
  Made-in-China.com
  Web Design Tips
  Web Hosting Reviews
  Web hosting reviews
  Website Design
  Cheapest web hosting
  Stock Photography
  Bildagentur
  Reseller Hosting
  Company Logos
  Website Templates
  Website Templates
  Web Hosting UK
  templatebox.com
  freewebtemplates.com
  templatesland.com
  topfreegraphics.com
  freegraphicland.com
  free-templates-layouts
  Logo Design Software
  Layouts4Free
  Webmaster Resoucres
  Web Templates Factory
  Free Web Templates
  Free Templates Catalog
  Web Templates
  Reseller Web Hosting
  Stock Photography
  Animations-galore.com
  4print.com.au
  Host Review
  Web Hosting Host Color
  Dedicated Servers
  FlashTemplateDesign
  ZeroDollarTemplates
  Killersites.com
  how-to-build-websites
  Build a free website
  web Hosting
  Business Logo Design
  Templates Favpage
  webmastermind.de
  flasheasy.com
  More Featured Sites