| Introduction to HTML 5: Tables | ||||||||||||||||||||||||||||||||
Simple Table CommandsTables are the most used format to construct web pages. They can be simple or complex. If there is one thing you should master as a beginner, it's understand tables. A table can look like this:
Here is the basic code to create the first table above: <TABLE> <TR> <TR> <TR> </TABLE> The command or tag for table is <TABLE> </TABLE> . A table MUST also include a tag for creating the row <TR> </TR> and MUST include a tag for displaying the data <TD> </TD> .
What Is Happening?What table commands do is create a series of cells. Each cell's data is denoted by the <TD> command. Please note that even though the program above has each cell (or TD) command on a new line, the cells keep going to the right until you tell the computer that a new row of cells will start by using the <TR> or Table Row command. You use the <TD> command to make cells across, and use <TR> to create a new row. Whatever follows the <TD> command will appear in the cell. And the cells, by column, will be of equal size using the largest cell as the model for the others. Table AttributesFour frequently used <TABLE> attributes are:
To create Table 2 above, the following code was used: <TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1"> <TR> <TD ALIGN = "center"> Red</TD> <TR> </TABLE>
Activating Cells For LinksBelow is an example of adding the Hypertext Link Tag within a table's cell:
The commands are the same for this table except you place a link command after the <TD> command. Here's what the command for the upper left-hand cell looks like: <TD align = "center"> The BORDER, CELLSPACING, AND CELLPADDING commands are all set at 20 in the above table to give you an example of some larger numbers. Images In CellsThis is the most frequent way to display a photo album.
All you have done is followed the TD command with an image command. Again, the command that creates the upper left-hand cell is this: <TD ALIGN = "center"> You can create tables with one cell or one hundred cells. In the next section, we will look at advanced table commands such as COLSPAN, ROWSPAN, and nested tables.
|
||||||||||||||||||||||||||||||||
| |