Share this Page URL

Chapter 10. Table Talk: Adding Tables to... > Table Refinishing—More Table Tidbits - Pg. 111

Table Talk: Adding Tables to Your Page 111 The standard-issue alignment for table cells is left aligned for data (<TD>) cells and centered for header (<TH>) cells. Not good enough? No sweat. Just shoehorn an ALIGN attribute inside the <TD> or <TH> tag and you can specify the text to be left aligned, centered, or right aligned. Here's how it works: <TD ALIGN="alignment"> <TH ALIGN="alignment"> In both cases, alignment can be LEFT, CENTER, or RIGHT. That's not bad, but there's even more alignment fun to be had. You can also align your text vertically within a cell. This comes in handy if one cell is quite large (because it contains either a truckload of text or a relatively large image), and you'd like to adjust the vertical position of the other cells in the same row. In this case, you use the VALIGN (vertical alignment) attribute with <TD> or <TH>: <TD VALIGN="vertical"> <TH VALIGN="vertical"> Here, vertical can be TOP, MIDDLE (the default alignment), or BOTTOM. Here's an example docu- ment (tblalign.htm on this book's CD) that demonstrates each of these alignment options: <HTML> <HEAD> <TITLE>Table Alignment</TITLE> </HEAD> <BODY> <TABLE BORDER> <CAPTION>Aligning Text Within Cells:</CAPTION> <TR> <TD></TD> <TD ALIGN=LEFT>Left</TD> <TD ALIGN=CENTER>Center</TD>