<td>

Description

This element creates a cell in a table. This element is used in conjunction with the <table> and <tr> elements. For each table row(<tr>) you can have one or more table details(<td>,cells).

Example


<html>
<body>
     <table>
          <tr>
               <td>Cell 1</td>
               <td>Cell 2</td>
          </tr>
          <tr>
               <td>Cell 3</td>
               <td>Cell 4</td>
          </tr>
     </table>
</body><!-- w ww  . jav  a 2 s. c  o  m-->
</html>

Click to view the demo

The code above generates the following result.

td

colspan attribute

This attribute determines how many columns in a table a particular cell spans.


<html>
<body>
     <table border="1">
          <tr>
               <th colspan="3">First Header (3 cells spanned)</th>
               <th>Second Header</th>
          </tr>
          <tr>
               <td height="79">Cell 1 content</td>
               <td height="79">Cell 2 content</td>
               <td height="79">Cell 3 content</td>
               <td height="79">Cell 4 content</td>
          </tr>
     </table>
</body><!--from   w w w  . ja v a  2 s .  c o m-->
</html>

Click to view the demo

The code above generates the following result.

td




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference