Hi, there. I am a block of text, floating out in the middle of nowhere on the right side of the page. |
Row 1 Column 1 |
Row 1 Column 2 |
Row 2 Column 1 |
Row 2 Column 2 |
<TABLE BORDER="1" ALIGN="LEFT">
<TR>
<TD>Row 1<BR>Column 1</TD>
<TD>Row 1<BR>Column 2</TD>
</TR>
<TR>
<TD>Row 2<BR>Column 1</TD>
<TD>Row 2<BR>Column 2</TD>
</TR>
</TABLE>
<TABLE>
and </TABLE>
tags. Second, you
enclose each row between <TR>
and </TR>
tags.
And finally, you enclose the contents of each cell in each row between <TD>
and </TD>
tags. (Compare the table above with the code carefully and make
sure you understand how it works before you continue.)
BGCOLOR
and the
WIDTH
attributes.
BGCOLOR
attribute used for setting the background of your page. In tables,
it's very powerful for this reason: you can set a different background color for each cell
in a table. Repeat that sentence to yourself until it sinks in.
Row 1 Column 2 |
|
Row 2 Column 2 |
<TABLE BORDER="0" WIDTH="20%">
<TR>
<TD BGCOLOR="#FFFFFF" WIDTH="10%"> </TD>
<TD BGCOLOR="#CCFFFF" WIDTH="10%">Row 1<BR>Column 2</TD>
</TR>
<TR>
<TD BGCOLOR="#FFFFFF" WIDTH="10%"> </TD>
<TD BGCOLOR="#CCFFFF" WIDTH="10%">Row 2<BR>Column 2</TD>
</TR>
</TABLE>
&nbsp;
is
called an entity: a way to enter special characters that otherwise can't be used in HTML. An entity
always begins with an ampersand and ends with a semicolon, and the characters in between tell what kind
of character to display. In this case, "nbsp" stands for "non-breaking space," which is a kind of space
that isn't treated as "white space"--in other words, you can string as many of these together as
you want and your browser won't just collapse them into one space. In this case we need this, as a
cell with just an ordinary space in it would be considered to be empty.
Terms to know from this lesson |
<TABLE> and </TABLE> tags: Enclose a
table structure. |
<TR> and </TR> tags: Enclose
one horizontal row of cells of a table. |
<TD> and </TD> tags: Enclose
the contents of a single cell within a row of a table. |
WIDTH attribute: Sets the width of a structure such as a
table, cell, graphic, etc., most commonly as a percentage. |
Entity: A sequence of characters that "stand in" for a special character that cannot be typed on a keyboard, or that cannot be typed directly into an HTML document for other reasons. For example, ">" stands for the ">" sign, which cannot be typed directly into an HTML document because it is used to close tags. |