About US
            Contact Us
            Book     Book Preface

Creating a Table in HTML

Chapter - 6 : Inserting Table in Web Page (Creating a Table in HTML): (Page 1/3)
The table command is used to insert tables in web page. Multiple tables and even one table in-side the other table can also be inserted. Due to this quality, some web designer use the 'table' tag to design complete web page layout. All table command starts with <table> and finishes with </table>
Tables are defined first by row and then by column.

i) Table Row: <tr> starts a row and </tr> ends the row.

ii) Table Column: <td> starts a column and </td> ends the column. The 'td' command is always within the 'tr' command.

<tr> Start of 1st Row
<td>Row 1 Col 1</td> details of 1st Column
<td> Row 1 Col 2</td> details of 2nd Column
</tr> End of 1st Row
<tr> Start of 2nd Row
<td> Row 2 Col 1</td> details of 1st Column
<td> Row 2 Col 2</td> details of 2nd Column
</tr> End of 2nd Row
And so on ....

a) Column Alignment : You can also defined the alignment of column by the command

<col align='left' />
<col align='right' />
This command will come after the <table> tag. You can even define different alignment to different column.

Command: <table>
<tr><td>Row 1 Col 1</td>
<td> Row 1 Col 2</td></tr>
<tr><td> Row 2 Col 1</td>
<td> Row 2 Col 2</td></tr>
<tr><td> Row 3 Col 1</td>
<td> Row 3 Col 2</td></tr>

Row 1 Col 1 Row 1 Col 2
Row 2 Col 1 Row 2 Col 2
Row 3 Col 1 Row 3 Col 2

As you notice that above table does not have any border and therefore not impressive. Therefore, add some border with table border command.

(Cont......... to next page (Pg-2))

table html © funandhobby.com (Creating a Table in HTML)