Introduction
Text
Formatting
Links
Lists
Images
Tables
Introduction to Tables
Table Attributes
TR Attributes
TD Attributes
Example
Frames
Forms
Conclusion


TD Tag Attributes
This is where you can customize each cell separately. Any attributes defined for a cell will override the attributes defined in that row.

BGCOLOR
Just like the BGCOLOR attribute in the TR tag, this attribute works the same it will define a background color for each cell.

<TD BGCOLOR="#0000FF">

ALIGN
This attribute also works the same as in the TR tag, it will align the content in within each cell. The values are: left, right, and center. Left is also the default.

<TD ALIGN="center">

VALIGN
This attribute also works the same as in the TR tag, it vertically aligns the content within the cell. The values are: top, middle, bottom, and baseline. The default is middle.

<TD VALIGN="middle">

The next following attributes are defined for the TD tag only.

COLSPAN
The colspan attribute merges a specific number of cells into one cell. This spans the cells across columns. The value is the number of columns a cell should span. Here is an example:

<TABLE>
<TR>
<TD COLSPAN="2"> Cell spanning 2 columns </TD>
</TR>
<TR>
<TD> Column 1 </TD>
<TD> Column 2 </TD>
</TR>
</TABLE>


Here is how it will look:

Cell spanning 2 columns
Column 1 Column 2

ROWSPAN
The rowspan attribute works like the colspan attribute, but it spans across rows instead of columns. The value is the number of rows a cell should span. Here is an example of the rowspan:

<TABLE>
<TR>
<TD ROWSPAN="2"> Cell spanning 2 rows </TD>
<TD> Row 1 </TD>
</TR>
<TR>
<TD> Row 2 </TD>
</TR>
</TABLE>


Here is how it will look:

Cell spanning 2 rows Row 1
Row 2

Note that the second row only has one TD tag, this is because you only need to define the rowspan on the top row and the following rows will need one less TD tag. Be careful not to have you rowspans cross your colspans.

NOWRAP
This attribute is empty and has no value, it tells the browser not to wrap the text in this cell (forcing it to stay on a single line). It can be wrapped manually with a <BR> tag. This can be useful sometimes when creating strict layout.

back  next

© Copyright 2000-2002 by Pepmint.com. All Rights Reserved

Search Pepmint.com

home :: tutorial :: portfolio :: links :: hammies :: guestbook :: contact