| Introduction to HTML 6: Advanced Table Commands | ||||||||||||||||||||||||||||
The COLSPAN CommandHere's a simple table that uses the COLSPAN command:
See how the top row spans across three columns? That's what the command does. COLSPAN is really an attribute of the TD tag/command. Here's the program that created the table above: <TABLE BORDER=3 CELLSPACING=3 CELLPADDING=3> </TABLE> Notice the first <TD> line. See how it contains the ALIGN command plus COLSPAN. Here's the deal:
NOTE: Notice how the code is indented two spaces for the <TR> and four spaces for the <TD>. This makes the code easier to read especially later when we get into nested tables. The ROWSPAN CommandHere's a simple table that uses the ROWSPAN command:
See how the first column spans across two rows? That's what the command does. ROWSPAN is really an attribute of the TD tag/command. Here's the code for the table above: <TABLE ALIGN="center" BORDER=3 WIDTH="400"
CELLSPACING=3 CELLPADDING=3> Again, the best thing to do is to draw out the table before you attempt to create it with HTML commands. Getting the spans is never the difficult thing. The problem is always where do you place the <TR> command to keep this information all inside the four corners. The WIDTH="--" AttributeThe width command denotes the width of the cell or width of the table. When you use numbers, like I did above, it is defining the width in pixels. If you use percentages, like WIDTH="20%" it is denoting width of the cell in relationship to the table. When you use the width attribute with the <TABLE> command, it sets the size of the table in relationship to the page. Please notice the percentage sign is required. Using percentages will allow the table to be an approximate size instead of a fixed size and can grow and shrink as the page itself is resized. Can I use COLSPAN and ROWSPAN commands together?Yes. This is where it starts to become tricky:
Here is the code for the above table: <TABLE WIDTH="500" BORDER="3" ALIGN="center"
CELLPADDING="3" CELLSPACING="3"> Again, the best thing to do is to draw out the table before you attempt to create it with HTML commands.
|
||||||||||||||||||||||||||||
| |
||||||||||||||||||||||||||||