How to adjust the alignment of a th?

1

I would like to know how do I adjust the alignment of a Table Heading <th> ? I do not know if it is possible to do this procedure as it is done for <tr> or <td> . I want to be able to do this to align the contents of each cell in my table with the text of <th> .

    
asked by anonymous 25.05.2017 / 20:09

1 answer

3

You can align with CSS and nothing else, look:

table, th, td {
    border: 1px solid black;
}

th, td{
  width: 100px;
}

th{
  text-align: left;
}
<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

Try changing .text-align and see how it changes

    
25.05.2017 / 20:16