Loading lesson path
Formula
HTML tables can have headers for each column or row, or for many columns/rows.8:00 9:00 10:00 11:00 12:00 13:00
8:00 9:00 10:00 11:00 12:00
Table headers are defined with th elements. Each th element represents a table cell.
<table> <tr>
Formula
< th > Firstname </th >
< th > Lastname </th >
< th > Age </th ></tr> <tr>
Formula
< td > Jill </td >
< td > Smith </td >
< td > 50 </td ></tr> <tr>
Formula
< td > Eve </td >
< td > Jackson </td >
< td > 94 </td ></tr> </table>
To use the first column as table headers, define the first cell in each row as a <th> element:
<table> <tr>
Formula
< th > Firstname </th >
< td > Jill </td >
< td > Eve </td ></tr> <tr>
Formula
< th > Lastname </th >
< td > Smith </td >
< td > Jackson </td ></tr> <tr>
Formula
< th > Age </th >
< td > 94 </td >
< td > 50 </td ></tr> </table>
By default, table headers are bold and centered:
50
94
Formula
To left - align the table headers, use the CSS
text - align property:Example th {
text-align: left;
}You can have a header that spans over two or more columns.
50