How To Create Tables In HTML

Tables provide a highly readable way of presenting many kinds of information. A table is specified using the tag <table></table>.



Code Snippet:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>My first web page</title>
</head>
<body>
<table>
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
<td>Row 1, cell 3</td>
</tr>
<tr>
<td>Row 2, cell 1</td>
<td>Row 2, cell 2</td>
<td>Row 2, cell 3</td>
</tr>
<tr>
<td>Row 3, cell 1</td>
<td>Row 3, cell 2</td>
<td>Row 3, cell 3</td>
</tr>
<tr>
<td>Row 4, cell 1</td>
<td>Row 4, cell 2</td>
<td>Row 4, cell 3</td>
</tr>
</table>
</body> </html>


The result of the above code is:




The table element defines the table. The tr element defines a table row. The td element defines a data cell. These must be enclosed in tr tags, as shown above.
If you imagine a 3x4 table, which is 12 cells, there should be four tr elements to define the rows and three td elements within each of the rows, making a total of 12 td elements.



A TABLE WITH ADDITIONAL ATTRIBUTES

Replace the above <td> tag with the below exapmle


<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
</table>


The result of the above code is:




Guys follow the various other tutorials to catch on further in html coding and designing