Sponsored Ad

Wednesday, December 2, 2009

How to create Table in HTML

There are a number of labels used in tables, and fully to grips with how the work is probably the most difficult area of this HTML tutorial for beginners.

Copy the following code into the body of your document and then we will go through what each tag is doing:

 

 

Code Snippet
  1. <table>
  2.     <tr>
  3.         <td>Row 1, cell 1</td>
  4.         <td>Row 1, cell 2</td>
  5.         <td>Row 1, cell 3</td>
  6.     </tr>
  7.     <tr>
  8.         <td>Row 2, cell 1</td>
  9.         <td>Row 2, cell 2</td>
  10.         <td>Row 2, cell 3</td>
  11.     </tr>
  12.     <tr>
  13.         <td>Row 3, cell 1</td>
  14.         <td>Row 3, cell 2</td>
  15.         <td>Row 3, cell 3</td>
  16.     </tr>
  17.     <tr>
  18.         <td>Row 4, cell 1</td>
  19.         <td>Row 4, cell 2</td>
  20.         <td>Row 4, cell 3</td>
  21.     </tr>
  22. </table>

The table element defines the table.

The TR element defines a table row.

The td element defines a data cell. These tags must be enclosed in T, as shown above.

If you imagine a table of 3x4, which is 12 cells, T must have four elements that define the rows and three td elements in each row, making a total of 12 td elements.

0 comments:

Post a Comment

Sponsored Ad

Website Update

Followers