<td
colspan="columns" |
Defines how many rows cell will span |
<tr>...</tr>
tag pairs while the number of columns are established by the number of <td>...</td>
tag pairs in each row. Typically, the table will be layed out like a grid with each cell's width equal to the width of one column and each cell's height equal to the height of one row. You may, however, have any cell spread over or 'span' the width of multiple rows or columns using special attributes in the <td>
tag.colspan="number of columns"
~ By default, the number of columns in a table is defined by the number of table data cells appearing in the table row that contains the most. You would, however, typically place the same number of data cells in each and every table row. If a table row does not contain the requisite number of table cells then it will essentially be in 'error' and will be displayed with a missing cell. <table border="3" bordercolor="#c86260" bgcolor="#ffffcc" width="50%" cellspacing="5" cellpadding="3">
<tr><td>MY DAILY MENU</td></tr>
<tr><td valign="top"><b>Breakfast</b></td><td>Orange juice<br>Toast<br>Black coffee</td></tr>
<tr><td valign="top"><b>Lunch</b></td><td>Tuna sandwich<br>Apple</td></tr>
<tr><td valign="top"><b>Dinner</b></td><td>Hamburger steak<br>Mashed potatoes<br>Green beans<br>Jello</td></tr>
</table>
MY DAILY MENU | |
Breakfast | Orange juice Toast Black coffee |
Lunch | Tuna sandwich Apple |
Dinner | Hamburger steak Mashed potatoes Green beans Jello |
colspan
attribute whose value defines how many columns a table cell will span. Hence, a <td>
tag using a colspan="2"
attribute-value pair will specify that that particular cell will stretch over the equivalent of two columns worth of space:<table border="3" bordercolor="#c86260" bgcolor="#ffffcc" width="50%" cellspacing="5" cellpadding="3">
<tr><td align="center" colspan="2">MY DAILY MENU</td></tr>
<tr><td valign="top"><b>Breakfast</b></td><td>Orange juice<br>Toast<br>Black coffee</td></tr>
<tr><td valign="top"><b>Lunch</b></td><td>Tuna sandwich<br>Apple</td></tr>
<tr><td valign="top"><b>Dinner</b></td><td>Hamburger steak<br>Mashed potatoes<br>Green beans<br>Jello</td></tr>
</table>
MY DAILY MENU | |
Breakfast | Orange juice Toast Black coffee |
Lunch | Tuna sandwich Apple |
Dinner | Hamburger steak Mashed potatoes Green beans Jello |
colspan="2"
in the 'MY DAILY MENU' table cell to make it span two columns, we also used align="center"
to center the content.rowspan="number of rows"
~ The rowspan
attribute works just like the colspan
attribute except that you may find the situation a little more difficult to visualize when working with the source code. But once again the principle is the same. By using the rowspan
attribute, you can force a table cell to span the number of rows specified by the respective value. <table border="3" bordercolor="#c86260" bgcolor="#ffffcc" width="50%" cellspacing="5" cellpadding="3">
<tr><td align="center" colspan="3">MY DAILY MENU</td></tr>
<!-- FIRST CELL IN THIS ROW SPANS THE NEXT 3 ROWS -->
<tr><td rowspan="3">M<br>o<br>n<br>d<br>a<br>y</td><td valign="top"><b>Breakfast</b></td><td>Orange juice<br>Toast<br>Black coffee</td></tr>
<tr><td valign="top"><b>Lunch</b></td><td>Tuna sandwich<br>Apple</td></tr>
<tr><td valign="top"><b>Dinner</b></td><td>Hamburger steak<br>Mashed potatoes<br>Green beans<br>Jello</td></tr>
</table>
MY DAILY MENU | ||
M o n d a y | Breakfast | Orange juice Toast Black coffee |
Lunch | Tuna sandwich Apple | |
Dinner | Hamburger steak Mashed potatoes Green beans Jello |
Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates
See also:
If you need a .COM web address, you can get one quick and easy at...
<~BACK | TOP | NEXT ~> |