Table: Headings

Table headings are defined with the <th> tag. By default, all major browsers display table headings as bold and centered. To left-align the table headings, use the CSS text-align property in the <style> element:

th { text-align: left; }
HTML file: Displayed by browser:
<style>
table {
    border-spacing: 1px;
    width: 100%;
}
th {
    color:teal;
    text-align:left;
}
td {
    border: 1px solid black;
    padding:10px;
    vertical-align:top;
}
</style>
<table>
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    <th>Points</th>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
</table>
Firstname Lastname Points
Eve Jackson 94
















Remember:

  • <td> is Table Data
  • <th> is Table Heading
  • <tr> is Table Row

Back button Table of Contents Next button