HTML Table Header
1.Header information in a table are defined with the <th> tag.
2.<th> tag stands for table header.
3.Table data can also be represented by the th element which results the contents centered and bold texts.
Example
<html>
<head>
</head>
<body>
<table border="1" >
<tr>
<tr>
<td>Data for header:1</td>
<td>Data for header:2</td>
<td>Data for header:3</td>
</tr>
<tr>
<td>Data for header:1</td>
<td>Data for header:2</td>
<td>Data for header:3</td>
</tr>
</table>
</body>
</html>
<head>
</head>
<body>
<table border="1" >
<tr>
<th>Table header:1</th>
<th>Table header:2</th>
<th>Table header:3</th>
</tr><th>Table header:2</th>
<th>Table header:3</th>
<tr>
<td>Data for header:1</td>
<td>Data for header:2</td>
<td>Data for header:3</td>
</tr>
<tr>
<td>Data for header:1</td>
<td>Data for header:2</td>
<td>Data for header:3</td>
</tr>
</table>
</body>
</html>
Output
Table header:1 | Table header:2 | Table header:3 |
---|---|---|
Data for header:1 | Data for header:2 | Data for header:3 |
Data for header:1 | Data for header:2 | Data for header:3 |
Note: First row is the table header now. Contents of table header are bold and centered.
No comments:
Post a Comment