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

Kelly Martin
Kelly Martin
4,859 Points

Why isn't this working? It works in the preview.

When I hit "check work" it tells me " Bummer! Header cells must be inside of a table row and have text in them." But when I select "preview" they show up as being headers. I've also tried aligning them to the bottom (as the previous challenge had me add a row to the first header) with the same result.

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>HTML Tables Challenge</title>
  </head>
  <body>
    <h1>HTML Tables Challenge</h1>

    <!-- Write your code below -->
   <table border="1">
     <thead>
     <tr>
       <th>Jem<br>and the</th>
       <th>The<br>Misfits</th>
       <th>Battle<br>of the Bands</th>
     </tr>
     </thead>
    <tr>
      <td>
      Holograms
      </td>
    </tr> 
    <tr>
      <td>
      Truly
      </td>
    </tr> 
     <tr>
      <td>
      Outrageous
      </td>
    </tr> 
   </table>
  </body>
</html>

3 Answers

Hi Kelly,

The error message wasn't very helpful but you put 3 header cells and task 4 is only asking for 2.

Also, be careful with the next steps because you've already added in extra markup below your table heading that the challenge hasn't specifically asked for yet.

Kelly Martin
Kelly Martin
4,859 Points

That's really helpful. I guess I misread it as "2 additional" instead of "2 total."

Zoltán Holik
Zoltán Holik
3,401 Points

I think you forget to add the tbody tag after the header.

<table>
      <thead>
        <tr>
          <th>Any text</th>
          <th>Any text</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Any text</td>
          <td>Any text</td>
        </tr>
      </tbody>
    </table>
Kelly Martin
Kelly Martin
4,859 Points

No, that's not it. tbody wasn't covered in the course, and it still didn't work once I added it in. It's telling me that the header must be in a row and contain text, which when I look at this is check and check