What's the difference between <th> and <thead>?

<th.>-------------> table heading
<thead.>-------->table heading

What’s the difference?

A lot, actually. There is only one THEAD and multiple TH, for starters.

  <caption>THEAD vs TH</caption>
    <tr><th colspan="3">TRUTH TABLE</th></tr>
      <th scope="col">true</th>
      <th scope="col">false</th>
      <th scope="row">true</th>
      <th scope="row">false</th>

When styled with this CSS,

table {
  border-collapse: separate;
  border: 1px solid black;
  width: 12em;
  margin: 1em auto;
th, td {
  padding: 5px;
  border: 1px solid red;
td {
  text-align: center;

gives the following result…



1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.