Table Width


One can specify the width of the table with the WIDTH attribute. For example:
<TABLE WIDTH="percent">
Usually this is expressed as a percentage of the width of the text area of the page. Here are two table examples, the first one with WIDTH="10%" and the second one with WIDTH="100%".
<TABLE BORDER="1" WIDTH="10%">
<CAPTION>Example 1:  TABLE WIDTH="10%"</CAPTION>
<TR>
<TD>Apples</TD> <TD>Bananas</TD> <TD>Cherries</TD>
</TR>
<TR>
<TD>Nectarines</TD> <TD>Oranges</TD> <TD>Papaya</TD>
</TR>
</TABLE>
Example 1: TABLE WIDTH="10%"
Apples Bananas Cherries
Nectarines Oranges Papaya

<TABLE BORDER="1" WIDTH="100%">
<CAPTION>Example 2:  TABLE WIDTH="100%"</CAPTION>
<TR>
<TD>Apples</TD> <TD>Bananas</TD> <TD>Cherries</TD>
</TR>
<TR>
<TD>Nectarines</TD> <TD>Oranges</TD> <TD>Papaya</TD>
</TR>
</TABLE>
Example 2: TABLE WIDTH="100%"
Apples Bananas Cherries
Nectarines Oranges Papaya

HTML will not always give you a table of the specified width because it has to fit the data into the cell. In Example 1 above, the table data is wider than 10% because the browser made the table wider in order to fit the data into the cell.

I understand the width attribute. How do I span multiple rows and columns?


[INDEX] [PREVIOUS] [NEXT PAGE] [CHAPTER 8]

Valid HTML 3.2!