|
Tables |
| Tables are one of the most functional thing in HTML and can be used to create a spectrum of effects and layout control.
|
|
|
Basic table |
| Tables start and end with the <table> tag. |
| The number of TD elements in a given row defines the number of columns in the table, while the number of TR elements defines the number of rows. |
| Here is an exmple: |
| <table> |
| <tr> |
| <td>Cell 1</td> |
| <td>Cell 2</td> |
| </tr> |
| <tr> |
| <td>Cell 3</td> |
| <td>Cell 4</td> |
| </tr> |
| </table> |
|
| A simple table |
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
|
|
The most popular attributes for the <table> tags:
|
| Attribute |
Description |
| border |
The border thickness in pixels. |
| bgcolor |
Specifies the background color of the Table in Hex or RGB triplet. |
| width |
Width of overall Table in pixels or percent. |
| cellpadding |
Pixels between the cell data and cell wall. |
| cellspacing |
Pixels between cells. |
|
|
|
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
| <table bgcolor=lightblue> |
|
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
|
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
|
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
|
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
|
| More Complicated Table |
| After combing all these properties, you can get a more complicated table. |
| <table border=4 bgcolor=lightblue width=200 cellspacing=4 cellpadding=4> |
| <tr> |
| <td>Cell 1</td> |
| <td>Cell 2</td> |
| </tr> |
| <tr> |
| <td>Cell 3</td> |
| <td>Cell 4</td> |
| </tr> |
| </table> |
|
| Cell 1 |
Cell 2 |
| Cell 3 |
Cell 4 |
|
|