Tables

Tables in HTML actually have two main purposes: one you know about, but the other may be news to you.

You know that tables can be used to structure information into rows and columns, as follows:

  column      
TABLE ROW
TABLE DATA cell TABLE DATA cell    
  TABLE DATA cell TABLE DATA cell    

What you probably don't realize is that tables are the main tool for page layout in HTML. Remember, HTML was designed to be a markup language, not a layout tool. So everybody creating content with HTML has to come up with creative ways of solving HTML limitations...and tables have become the common way to solve layout problems.

Tables allow for multi-columns on a web page, for example...or separate navigation and contents areas. Now, for visual comparison, take a look at the table below with the HTML elements that define the table above:

<TABLE>

 

   
<TR>
<TD> <TD>  
<TR>
<TD> <TD>  
</TABLE>
     

In an HTML table, you identify rows by the table row TR element. You identify the contents of each table data cell with the table data TD element. The unique characteristic of HTML tables is that you don't need to specify columns...the browser will infer the number of columns by the number of table data TD cells in each table row (and if the number of table data cells varies from row to row, the browser will define the table using the row with the greatest number of table data cells). When the browser reads the table above, it will infer a two-column table because each row has two table data TD cells. Got it?

So, the order of tags for a table with two rows and two columns would be:

<TABLE>

<TR>
<TD>
<TD>

<TR>
<TD>
<TD>

</TABLE>

 

 

 

Copyright © 2001 Michael J. Doyle
All Rights Reserved.

Designed & Developed by Mike Doyle
using Macromedia Dreamweaver & CourseBuilder

See Mike's Training Schedule for
HTML, Dreamweaver, & CourseBuilder Courses


Email Mike Doyle