weballey logo
 
left Tables - expanding backnext right
homesearchsite mape-mail
basics
< expanding >
sizing
colors
borders
alignment
nesting
navbar
quick recap
tags
epilogue
      There can be more than one cell in a row. And as always in HTML, it does not really matter if you put each tag on a seperate line or not. Take great care in the sequence and position of the tags. Cell contents can only be inside TD tags, TD tags can only be inside TR tags, TR tags can only be inside TABLE tags. Putting a tag or cell contents anywhere else may always give unpredictable results, even render your table invisible.

<TABLE BORDER="1">
<TR><TD>cell 1</TD><TD>cell 2</TD><TD>cell 3</TD></TR>
</TABLE>

cell 1cell 2cell 3

    Adding a row is done by putting a second set of TR tags inside the table tags. It does not really matter how many cells there are in a row. The table width is determined by the longest row. Missing cells are filled out with blank space, as you can see below. Another thing you may have noticed, is that columns are created rather indirectly. A cell is always as wide as the cell above it.

<TABLE BORDER="1">
<TR><TD>cell 1</TD><TD>cell 2</TD><TD>cell 3</TD></TR>
<TR><TD>cell 4</TD><TD>cell 5</TD></TR>
</TABLE>

cell 1cell 2cell 3
cell 4cell 5

    If you want to have a wider cell, you can combine two or more cells. This is done with the COLSPAN attribute, short for COLumn SPAN. And as you may have guessed, you can let a cell span two or more rows, with the ROWSPAN attribute. If you let a cell span two columns, there will be less space. In the example below two cells in a row that is normally three wide. Take care you don't add the cell anyway. It would stretch your table and create a blank area in the other rows.

<TABLE BORDER="1">
<TR><TD>cell 1</TD><TD>cell 2</TD>
<TD ROWSPAN="2">cell 3</TD></TR>
<TR><TD COLSPAN="2">cell 4</TD></TR>
</TABLE>

cell 1cell 2cell 3
cell 4

goto top  
leftCopyright © Gerben Hoekstra - All rights reserved backnext right