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

Chris Gutierrez
Chris Gutierrez
6,911 Points

why is the table not correct?

I added a table tag and created a table heading inside and getting an error. don't know why. can someone please help. thanks

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

    <!-- Write your code below -->
<table>
  <th></th>
</table>


  </body>
</html>
Bob McCarty
Bob McCarty
Courses Plus Student 16,618 Points

The challenge wants the "thead" not the "th" tag.

Hi Chris ! It shouldn't show an error but the format of your table isn't quite good. First, you need to add a column to your table with a - tr - tag. Second, you need to add some rows to your table with - th - tag (for the name of the row) and - td - tag for the value of the row.

Like this:

<!DOCTYPE html>
<html>
    <head>
        <title>HTML Tables Challenge</title>
    </head>
    <body>
        <h1>General Informations</h1>
        <!-- Write your code below -->
        <table>
            <tr>
                <th> First Name </th>
                <td> Rew </td>
            </tr>
            <tr>
                <th> Last Name </th>
                <td> Le Bris </td>
            </tr>
            <tr>
                <th> Email </th>
                <td> rew@gmail.com </td>
            </tr>
            <tr>
                <th> Message </th>
                <td> Hello world </td>
            </tr>
        </table>
    </body>
</html>

PS: Be careful with the indentation or you'll be lost in your code very soon when you'll have hundreds of html lines :) See my code ? It's clearer. A good indentation will help you finding in a more efficient way your mistakes.

Hope this will help you ! Have a great day and don't hesitate to up-vote my answer if it helped you ! :)

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Chris,

Task 2 is looking for a Table Heading Tag <thead> (As Bob pointed out). So, you are close and these tags can be confusing when starting out with Tables. Just replace the th with thead and you're good to go.

You can read more on the differences between the <th> and the <thead>.

Keep Coding! :)

Claudiu Bancos
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Claudiu Bancos
Front End Web Development Techdegree Graduate 22,468 Points

I opened up the challenge, copy/pasted your code exactly as you have it, and did not get any sort of error.

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

    <!-- Write your code below -->
<table>
  <th></th>
</table>

  </body>
</html>

Yeah as I said before in the previous answer, there is no error in his code, just a bad use of the table standard tags. W3C is watching you haha :D