HTML Table Attributes

Tables in HTML pages are created by using multiple HTML tags with specific attributes defining table structure. I have prepared HTML table attributes list, please feel free to use it as cheat sheet while crafting HTML tables and forms.

Table Attribute List

Define Table: <TABLE></TABLE>
Columns to Span: <TH COLSPAN=?>
Rows to Span: <TH ROWSPAN=?>
Desired Width: <TH WIDTH=?>(in pixels)
Width Percent: <TH WIDTH="%">(percentage of table)
Cell Color: <TH BGCOLOR="#$$$$$$">
Table Caption: <CAPTION></CAPTION>
Alignment: <CAPTION ALIGN=TOP|BOTTOM>(above/below table)
Table Border: <TABLE BORDER=?></TABLE>
Cell Spacing: <TABLE CELLSPACING=?>
Cell Padding: <TABLE CELLPADDING=?>
Desired Width: <TABLE WIDTH=?>(in pixels)
Width Percent: <TABLE WIDTH="%">(percentage of page)
Table Row: <TR></TR>
Alignment: <TR ALIGN=LEFT|RIGHT| CENTER|MIDDLE|BOTTOM
VALIGN=TOP|BOTTOM|MIDDLE>

Table Cell: <TD></TD>(must appear within table rows)
Alignment: <TD ALIGN=LEFT|RIGHT| CENTER|MIDDLE|BOTTOM
VALIGN=TOP|BOTTOM|MIDDLE>

No linebreaks: <TD NOWRAP>
Columns to Span: <TD COLSPAN=?>
Rows to Span: <TD ROWSPAN=?>
Desired Width: <TD WIDTH=?>
Width Percent: <TD WIDTH="%">(percentage of table)
Cell Color: <TD BGCOLOR="#$$$$$$">
Table Header: <TH></TH>(same as data, except bold centered)
Alignment: <TH ALIGN=LEFT|RIGHT| CENTER|MIDDLE|BOTTOM
VALIGN=TOP|BOTTOM|MIDDLE>

No Linebreaks: <TH NOWRAP>

I hope this was helpful. If you have any questions or suggestions leave them in the post comments section.

2 Responses