| Webhelp.org Presents: Crashcourse In Tables!
<TABLE> <CAPTION>What Is A Table?</CAPTION> <TD>THIS <TD>IS A <TD>TABLE!<TR> <TD>NOW <TD>LEARN <TD>HOW!<TR> </TR> </TD> </TABLE> As you can see, you start by defining the TABLE, you may add a CAPTION (optional), each "CELL" of the TABLE starts with TD (which stands for Table Data) and from what I was taught, does not need to end with /TD until the last Table Data, A TR defines a new Table Row and does not need to end with /TR until the last Table Row and the whole shooting match ends with a /TABLE!
<TABLE BORDER=1> This will give your table a BORDER!
<TABLE BORDER=2 CELLSPACING=2 CELLPADDING=2> Well that's fine and dandy, but the data inside the tables aren't centered like in the above example! That's easy to fix! In each TD you can define the data's alignment. <TD ALIGN=CENTER> This will center any data within the cell.
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1> <CAPTION>What Is A Table?</CAPTION> <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">THIS <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">IS A <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">TABLE!<TR> <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">NOW <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">LEARN <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">HOW!<TR> </TR> </TD> </TABLE> Using Hexadecimal Color Codes (the same ones you use to define the body of a page) you can define each cell's characteristics, including font face.
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1> <CAPTION>What Is A Table?</CAPTION> <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">THIS <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">IS A <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">TABLE!<TR> <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">NOW <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">LEARN <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">HOW!<TR> <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">MISTER <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF"><IMG SRC="happyface.gif"> <TD ALIGN=CENTER BGCOLOR="#000000"><FONT COLOR="#FFFFFF">HAPPYFACE<TR> </TR> </TD> </TABLE>
Colspan and RowspanSay you want one of your rows to take up two or more columns or vice versa. This is where the COLSPAN and ROWSPAN tags come into play. The easy one to use is COLSPAN. This tag determines how many columns across a cell of a table will be. <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1> <CAPTION>What Is A Table?</CAPTION> <TD ALIGN=CENTER COLSPAN=3>THIS IS A TABLE!<TR> <TD ALIGN=CENTER>NOW <TD ALIGN=CENTER>LEARN <TD ALIGN=CENTER>HOW!<TR> </TR> </TD> </TABLE> What happens here is "NOW LEARN HOW" takes up 3 cells in the second table row. Therefore, when the colspan is three, only one cell is shown for the top. This appears like this:
If a colspan of two was used, one cell would be left over on the top row. <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1> <CAPTION>What Is A Table?</CAPTION> <TD ALIGN=CENTER COLSPAN=2>THIS IS A <TD ALIGN=CENTER>TABLE!<TR> <TD ALIGN=CENTER>NOW <TD ALIGN=CENTER>LEARN <TD ALIGN=CENTER>HOW!<TR> </TR> </TD> </TABLE>
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1> <CAPTION>What Is A Table?</CAPTION> <TD ALIGN=CENTER ROWSPAN=3>THIS IS A TABLE! <TD ALIGN=CENTER>NOW<TR> <TD ALIGN=CENTER>LEARN<TR> <TD ALIGN=CENTER>HOW!<TR> </TR> </TD> </TABLE>
Now that you know quite a bit about tables, you can return to Jonny's HTML Headquarters!
E-Mail Jonny Webhead |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||