HTML table markup tutorial (14): table headers

Time:2022-6-10

In the HTML language, you can automatically add a title to a table by marking it. In addition, the first row of the table is called the header, which can also be achieved through HTML tags.
Basic grammar
<TABLE> ….

  <TR>

<th> Title 1</th><th> Title 2</th><th> Title 3</th><th> Title 4</th><th> Title 5</th>
  </TR>

 ……..

</TABLE>

Grammatical interpretation
Define the width of the border line in pixels through the border attribute.
<html>
<head>
<title> comprehensive examples of table tags </title>
</head>
<body>
<table border=”1″ width=”80%” bgcolor=”#e8e8e8″ cellpadding=”2″ bordercolor=”#0000ff” bordercolorlight=”7d7dff” bordercolordark=”#0000a0″>
<tr>
<th width= “30%” colspan= “2” valign= “bottom” > Atlantic Division </th>
<th width= “30%” colspan= “2” valign= “bottom” > Central Division </th>
<th width= “30%” colspan= “2” valign= “bottom” > Southeast Division </th>
</tr>
<tr>
<td width= “16%” align= “center” > Celtic</td>
<td width= “16%” align= “center” >76 people</td>
<td width= “17%” align= “center” > piston</td>
<td width= “17%” align= “center” > bull</td>
<td width= “17%” align= “center” > heat</td>
<td width= “17%” align= “center” > Wizards</td>
</tr>
<tr>
<td width= “16%” align= “center” > net</td>
<td width= “16%” align= “center” > Knicks</td>
<td width= “17%” align= “center” > walkers</td>
<td width= “17%” align= “center” > Knight</td>
<td width= “17%” align= “center” > Magic</td>
<td width= “17%” align= “center” > SM</td>
</tr>
<tr>
<td width= “16%” align= “center” > Raptors</td>
<td width= “16%” align= “center” > crossing the river</td>
<td width= “17%” align= “center” > bucks</td>
<td width= “17%” align= “center” > zhijiage</td>
<td width= “17%” align= “center” > Eagle</td>
<td width= “17%” align= “center” > Yao Ming</td>
</tr>
</table>
</body>
</html>

Where <th></th> refers to the header and title of the table.