Tables are used on websites for two major purposes:
- The obvious purpose of arranging information in a table
- The less obvious - but more widely used - purpose of creating a page layout with the use of hidden tables.
Using tables to divide the page into different sections is an extremely powerful tool.
Almost all major sites on the web are using invisible tables to layout the pages.
The most important layout aspects that can be done with tables are:
- Dividing the page into separate sections.
An invisible table is excellent for this purpose. - Creating menus.
Typically with one color for the header and another for the links following in the next lines. - Adding interactive form fields.
Typically a gray area containing a search option. - Creating fast loading headers for the page.
A colored table with a text on it loads like a bullet compared to even a small banner. - Easy alignment of images that have been cut into smaller pieces.
- A simple way to allow text to be written in two or more columns next to each other.
The importance of using tables for these layout purposes can't be overrated. However there are a few things to keep in mind when doing so.
Most important is, that the content of a table is not shown until the entire table is loaded. If you have extremely long pages, you should divide it into two or more tables - allowing the user to start reading the upper content while the rest of the page is loading.
Tables are defined with the <table> tag.
To insert a table on your page you simply add these tags where you want the table to occur:
|
The above table would be of no use since it has no rows and no columns.
ROWS:
To add rows to your table use the <tr> and </tr> tags.
Example:
|
It doesn't make sense to write the above lines in itself, cause you can't write content outside of table cells.
If you do write things outside of cells it will appear right above the table.
COLUMNS:
You can divide rows into columns with <td> and </td> tags:
Example:
|
Result:
|
The following properties can be added to the <table> tag:
|
Note:
Table properties are set for the entire table.
If certain properties are set for single cells, they will have higher priority than the settings for the table as a whole.
These settings can be added to both <tr> and <td> tags.
|
These settings are only valid for <td> tags.
|
Note:
Settings for columns(<td> tag) have higher priority than settings for rows(<tr> tag).
Settings for cells (<tr> or <td> tags) have higher priority than settings for the table as a whole(<table> tag).

0 comments:
Post a Comment