Table

HTML Tables

Example

<html>
<Head>
<tittle>Table tag </tittle>
</Head>
<body>
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td> </tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
</body>
</html>

Output:-

How it looks in a table:-

row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

Headings in a Table

Example

<html>
<Head>
<tittle>Headings in a Table tag </tittle>
</Head>
<body>
<table border="1">
<tr>
<th>Heading</th>
<th>Another Heading
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td> </tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
</body>
</html>

Output:-

Headings in a table are defined with the <th> tag.

Heading Another Heading
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2