A table is a container for all kinds of stuff. It consists of the table container and table cells, created by defining rows and cells within those rows. The actual data goes in the cells. By manipulating the space between the data and the cell edge, the space between the cells and the border design, you can achieve some striking effects. Tables, but not cells, can have margins defined, the space around the outside of the table. Cells, but not tables, can have padding defined, the space between the cell content and cell edge. The current recommendation by the W3C is that tables be used for displaying data and not as a layout tool. Here’s some code for a 2-cell table displaying the formula 1+1 = 2 that would look something like this:
The formula |
1+1 = 2 |
The <table> tag indicates the start of a table. Within the tag are attributes with values enclosed in quotes that define characteristics for the table. The <tbody> tag says that the table body starts here. You could have an optional set of <caption> tags between the <table> and <tbody> tags. <tr> indicates the beginning of a table row. <td> is the start tag for a table cell. These td tags each include the width attribute and have a value of 100 pixels. The characters &nbs; (called an entity), are HTML code for inserting a non-breaking space into your text. HTML normally ignores extra white space in your document. The tags are all closed to indicate the end of a data cell, end of a table row, end of the table body and end of the table.
|
HTML/XHTML Tag Resources |
|
| http://www.w3schools.com/html/html_reference.asp | |
| Another HTML 4.01 Tag Reference | http://www.webreference.com/html/reference/specs/ |
Library of Congress Guidelines for HTML 4.01 |
http://www.loc.gov/iug/html40/40tags.html |