HTML Table THEAD Tag does not extend entire width

3810 views html
6

enter image description hereWhy doesn't the THEAD tag extend the entire length? Table THEAD Screenshot

answered question

1 Answer

0

Both table and thead tags aren't block elements, so they won't take 100% of the parent's width.

You can simply fix that using display: block or width: 100%.

table {
  width: 100%;
  background: lightblue;
}
<table>
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
</table>

About the display property (MDN)

posted this

Have an answer?

JD

Please login first before posting an answer.

Ads

Categories