If you already thoroughly understand alignment in table-cells, you can skip this lesson.
We've already covered the alignment of caption and cell contents (text) in the last chapter, but we hadn't introduced graphical tables at that time, and you may have found it somewhat difficult to visualize the alignments taking place when no cell borders were present. In this lesson, we'll provide some examples of alignment, so that you can see the effects, and review the source code. Let's go directly to the examples:
<TABLE BORDER=10 CELLPADDING=10 CELLSPACING=10> <CAPTION>"DUMB" TABLE</CAPTION> <TR><TH HEIGHT=50 WIDTH=100>whut?</TH> <TH HEIGHT=50 WIDTH=100>huh?</TH> <TH HEIGHT=50 WIDTH=100>duh</TH></TR> <TR><TD HEIGHT=50 WIDTH=100>um</TD> <TD HEIGHT=50 WIDTH=100>snore</TD> <TD HEIGHT=50 WIDTH=100>uhhh</TD></TR> <TR><TD HEIGHT=50 WIDTH=100>yow</TD> <TD HEIGHT=50 WIDTH=100>ack</TD> <TD HEIGHT=50 WIDTH=100>zzz</TD></TR> </TABLE> <BR><BR><BR><BR> <TABLE BORDER=10 CELLPADDING=10 CELLSPACING=10> <CAPTION ALIGN=TOP >"DUMB" TABLE</CAPTION> <TR ALIGN=LEFT VALIGN=TOP><TH HEIGHT=50 WIDTH=100>whut?</TH> <TH HEIGHT=50 WIDTH=100>huh?</TH> <TH HEIGHT=50 WIDTH=100>duh</TH></TR> <TR ALIGN=CENTER VALIGN=MIDDLE><TD HEIGHT=50 WIDTH=100>um</TD> <TD HEIGHT=50 WIDTH=100>snore</TD> <TD HEIGHT=50 WIDTH=100>uhhh</TD></TR> <TR ALIGN=RIGHT VALIGN=BOTTOM><TD HEIGHT=50 WIDTH=100>yow</TD> <TD HEIGHT=50 WIDTH=100>ack</TD> <TD HEIGHT=50 WIDTH=100>zzz</TD></TR> </TABLE> <BR><BR><BR><BR> <TABLE BORDER=10 CELLPADDING=10 CELLSPACING=10> <CAPTION ALIGN=BOTTOM >"DUMB" TABLE</CAPTION> <TR><TH HEIGHT=50 WIDTH=100 ALIGN=LEFT VALIGN=TOP>whut?</TH> <TH HEIGHT=50 WIDTH=100 ALIGN=CENTER VALIGN=MIDDLE>huh?</TH> <TH HEIGHT=50 WIDTH=100 ALIGN=RIGHT VALIGN=BOTTOM>duh</TH></TR> <TR><TD HEIGHT=50 WIDTH=100 ALIGN=LEFT VALIGN=TOP>um</TD> <TD HEIGHT=50 WIDTH=100 ALIGN=CENTER VALIGN=MIDDLE>snore</TD> <TD HEIGHT=50 WIDTH=100 ALIGN=RIGHT VALIGN=BOTTOM>uhhh</TD></TR> <TR><TD HEIGHT=50 WIDTH=100 ALIGN=LEFT VALIGN=TOP>yow</TD> <TD HEIGHT=50 WIDTH=100 ALIGN=CENTER VALIGN=MIDDLE>ack</TD> <TD HEIGHT=50 WIDTH=100 ALIGN=RIGHT VALIGN=BOTTOM>zzz</TD></TR> </TABLE>
whut? | huh? | duh |
---|---|---|
um | snore | uhhh |
yow | ack | zzz |
whut? | huh? | duh |
---|---|---|
um | snore | uhhh |
yow | ack | zzz |
whut? | huh? | duh |
---|---|---|
um | snore | uhhh |
yow | ack | zzz |
For all the demonstration tables, we've explicitly sized every cell to 100 x 50 (W x H) so that the cell will be large enough to observe the text word being aligned inside it. In addition, we've applied border, cellpadding, and cellspacing (all of these sized at 10 pixels), so that we can see the effect of alignment with relation to those attributes. Let's look at our results:
We ask that you kindly overlook the author's glaring lack of creativity in building table content. [at least nobody will accuse me of plagiarizing]