Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Tables HTML Tables

Anthony Osborn
Anthony Osborn
17,095 Points

The question on 'Adding table heading tag' not working

Hi

I've been trying to pass the question 'Try adding a table heading tag to your table' for several hours now so I can continue learning.

Here is my code, what am I doing wrong?

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>My Page</title>
</head>

<body>

  <table border="1">
    <tr>
      <th>Fruits</th>
      <th>Vegetables</th>
    </tr>
    <tr>
      <td>Oranges</td>
      <td>Carrots</td>
    </tr>
    <tr>
      <td>Apples</td>
      <td>Broccoli</td>
    </tr>
    <tr>
      <td>Strawberries</td>
      <td>Asparagus</td>
    </tr>
    <tr>
      <td></td>
      <td>Potatoes</td>
    </tr>
  </table>

</body>
</html>

Any help on this I'd greatly appreciate.

Thanks Anthony

2 Answers

Michael Hulet
Michael Hulet
47,913 Points

Try this:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>My Page</title>
</head>

<body>

  <table border="1">
   <!-- I think you're going to end up dividing your table into a thead and a tbody, and I think this is where you're supposed to start -->
    <thead>
    </thead>
    <tr>
      <th>Fruits</th>
      <th>Vegetables</th>
    </tr>
    <tr>
      <td>Oranges</td>
      <td>Carrots</td>
    </tr>
    <tr>
      <td>Apples</td>
      <td>Broccoli</td>
    </tr>
    <tr>
      <td>Strawberries</td>
      <td>Asparagus</td>
    </tr>
    <tr>
      <td></td>
      <td>Potatoes</td>
    </tr>
  </table>

</body>
</html>
Anthony Osborn
Anthony Osborn
17,095 Points

Awesome! Thank you. Worked great.

Anthony