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; Code Challenge, Task 2

For some reason this is incorrect?

    <table>
    <tr>
    <th>This is a table header</th>
    </tr>
    </table>

Correct me if I'm wrong, but this seems to be right. Thoughts?

13 Answers

Try using 'thead' in stead of 'th' (The exact code doesn't appear when I type it here)

I had the same problem, this worked for me!

@Robbert Ok, that's really weird. It worked for me too, but this is certainly a bug.

@Robbert Thanks for your help!

Great, now I can't pass task 3. This is stupid. They are using a different version for the code challenge than the video (or something else).

If anyone from Treehouse is looking at this, please give me the instructions for this. I really don't want to miss the deadline for the learning adventure!

Edit: just sent them an email. Hopefully that helps :)

This is the complete assignment

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

<!-- Write your code below -->
    <table>
  <thead>
    <tr>
        <th>any text</th>
        <th>any text</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td> Text </td>
      <td> Text </td>
    </tr>
    <tr>
      <td colspan="2"> Two columns </td>
    </tr>
  </tbody>  
</table>

</body> </html>

@Robbert Thanks again! You've been really helpful for me today :)

No prob buddy. It seems that treehouse does not recognize different html for a single purpose; <strong> is ok. <b> is not, even though the editor recognizes it.

@Robbert -

It seems that treehouse does not recognize different html for a single purpose

The <thead> & <th> are not equivalent.

The purpose of <thead> is to section the content with 3 semantic sections for the <thead>, <tfoot> & <tbody>.

The purpose of <th> is for a row heading similar to a spreadsheet, it works the same way as <td> but you only use it when you want a row header.

If you want more information about html tables you can read up on using html tables to organize data with Learn HTML & CSS

ok. so,
the footer and the body data use <td> nested in <tr>, whereas the header uses<th> nested in <tr>... (or, to put it another way, use <th> instead of <td> when in a header...)

yes?

(while playing in codepen and watching the video, I got confused because codepen allowed me to use <td> in the header, so that's how I was trying to do it in the code challenge, and it wasn't accepting it. After I ate lunch and came back it seems obvious now)

argh, i tried to open the markdown cheatsheet and it just sent me back to this page with my letter sent! and i don't see a delete or edit button anywhere... here's what i meant to say: (what's in quotes is tags)

so, the footer and the body data use "td" nested in "tr", whereas the header uses "th" nested in "tr" ... or, to put it another way, use "th" instead of "td" when in a header... yes?

To understand the awesome power behind breaking up your table using semantic markup you have to create a pricing table using CSS.

This one was created using pure css (except for the check marks of course)

css pricing table

Here's the tutorial where you pimp your tables with CSS3, however before you can get here you have to learn about the HTML markup in order to make it work.

I had the same problem yesterday, but <thead></thead> worked for me.

Forgot to indent 4 spaces <thead></thead>

@James -

Thanks for the clarification, my bad ;)

So what about the <b> and <strong>? Their functions are equal right?

@Robbert - I can't understand your question. I think maybe you forgot to enclose your code in backticks.