ToC ~ Up ~ Prev ~ Next ~ Index |
Introduction to HTML Last Update: 5 January 1998 |
On This Page: TR Alignment ~ TD/TH Alignment ~ TD and TH Override TR |
The TR Element defines a single table row. The TR element can take the attributes ALIGN and VALIGN, which define alignment properties for the contents of cells within that row. ALIGN, which defines the horizontal alignment properties, can take the values "left", "center" and "right", while VALIGN, which defines the vertical alignment properties of the cells, can take the possible values "top", "middle", "bottom". The default values are ALIGN="left", and VALIGN="middle".
The individual table cells, defined by the TD and TH elements, can also take the alignment attributes, to specify the alignment of the particular cell. This overrides the alignment specification given by TR, as shown in the examples below. The default values for TD cells are ALIGN="left", and VALIGN="middle", whle the default values for TH are ALIGN="center", and VALIGN="middle".
The following table illustrates the effect of TR attributes:
<table border width=40%> <TR> <TH> Head 1<BR>bloop </TH> <TH> Head 2 </TR> <TR ALIGN="left"> <TH> Head 1<BR>bloop </TH> <TH> Head 2 </TR> <TR VALIGN="bottom"> <TH> Head 1<BR>bloop </TH> <TH> Head 2 </TR> <TR> <TH> Head 1<BR>bloop </TH> <TH> Head 2 </TR> <TR ALIGN="center"> <TD> 4.11<BR>aaaa </TD> <TD> 4.23 </TR> <TR ALIGN="right"> <TD> 4.11<BR>aaaa </TD> <TD> 4.23 </TR> <TR VALIGN="top"> <TD> 4.11<BR>aaaa </TD> <TD> 4.23 </TR> <TR VALIGN="bottom"> <TD> 4.11<BR>aaaa </TD> <TD> 4.23 </TR> </table>
This is displayed by your browser as: (I hope your browser supports tables!)
Head 1 bloop | Head 2 |
---|---|
Head 1 bloop | Head 2 |
Head 1 bloop | Head 2 |
Head 1 bloop | Head 2 |
4.11 aaaa | 4.23 |
4.11 aaaa | 4.23 |
4.11 aaaa | 4.23 |
4.11 aaaa | 4.23 |
As the following example illustrates, alignment attributes on TD or TH attributes override those alignments specified by the TR:
<table border width=40%> <TR> <TD>4.11<BR>aaaa</TD> <TD> 4.23 </TR> <TR ALIGN="center" VALIGN="center"> <TD>4.11<BR>aaaa</TD> <TD> 4.23 </TR> <TR ALIGN="center" VALIGN="center"> <TD>4.11<BR>aaaa</TD> <TD VALIGN="top"> 4.23 </TR> </table>
This TABLE is displayed as:
4.11 aaaa | 4.23 |
4.11 aaaa | 4.23 |
4.11 aaaa | 4.23 |
ToC ~ Up ~ Prev ~ Next ~ Index |
Introduction to HTML © 1994-1998 by Ian Graham Last Update: 5 January 1998 |