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 Table Challenge--Put 2 header cells with text inside row just created. I'm having difficulty with this.

<table border="1"> <thead> <tr> <th>Food Groups</th> <th>Blank</th> <th>Filled</th> </tr> </thead>

This is what I wrote, but it isn't correct. What am I doing wrong?

14 Answers

Can you text your code pls? :)

when i copy and paste my code i dont think it shows up when i submit the comment.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Nick Mclean | Designer</title> </head> <body> <header> <a href="index.html"> <h1>Nick Mclean</h1> <h2>Designer</h2> </a> <nav> <ul> <li><a href="index.html"></a>Portfolio</li> <li><a href="about.html"></a>About</li> <li><a href=contact.html"></a>Contact</li> </ul> </nav> </header> <section> <p>Gallery Will go here.</p> </section> <footer> <p>© 2014 Nick Mclean.</p> </footer> </body> </html>

Hello, placing code should be straight forward, there is a character on your keyboard that resembles a comma. It looks like this ( ` ). When you find it, type it out (3x) three times on the line below & above your code.

And your code should appear like this!

for more info on how to format your discussion on the forum check out the Markdown Cheatsheet link on the bottom right of the textarea.

Here is my code: <!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>Food Groups</th> <th>Blank</th> <th>Filled</th> </tr> </thead> <tr> <th>Fruits</th> <th>Vegetables</th> </tr> <tr> <td>Apples</td> <td>Bananas</td> </tr> <tr> <td>Carrots</td> <td>Potatoes</td> </tr> </table> </body> </html>

What did I do incorrectly? Thanks.

From this post I would say that your <!doctype html> "document tag" should be capitalized.

Here is my code:

<table border="1">
  <thead>
    <tr>
      <th>Food Groups</th>
      <th>Blank</th>
      <th>Filled</th>
    </tr>
   </thead>
     <tr>
       <th>Fruits</th>
       <th>Vegetables</th>
     </tr>
     <tr>
       <td>Apples</td>
       <td>Bananas</td>
     </tr>
     <tr>
       <td>Carrots</td>
       <td>Potatoes</td>
     </tr>
  </table>
 </body>
</html>

What did I do incorrectly?

from this post I would say that your "body" & "html" tags are incomplete.

Also it would seem that a good portion of your code is written outside of the table head <thead>element and should probably be kept within the table body element <tbody>

I found the webpage (https://teamtreehouse.com/library/html/tables/rows-and-cells) and reviewed the material, it never hurts to have a second go at treehouse material.

From there I was able to complete the challenge and remember how the code was suppose to be layed out and how it looked in the preview.

Hope this helps!

<!DOCTYPE html>

<html>

  <head>

    <title>HTML Tables Challenge</title>

  </head>

  <body>

    <h1>HTML Tables Challenge</h1>

    <table border="1">

      <thead>

      <tr>
            <th>heading one</th>

               <th>heading two</th>
        </tr>

      </thead>

      <tbody>
          <tr>

            <td>cell 1</td>
            <td>cell 2</td>

        </tr>


        <tr> 
            <td colspan="2"> cell number 5</td>
        </tr>

      </tbody>

    </table>

  </body>

</html>

1) There was no <tbody></tbody> in this HTML Rows & Columns lesson. 2) I deliberately left out the <!doctype html> down to the "Write your HTML code here" as that is already assumed. It isn't necessary to capitalize the document tag. Nick Pettit doesn't do it. 3) There was no instruction to include <thead> <tr> <td colspan="2"> </tr> </thead> above <tr> <th>table heading 1</th></tr> at the point I was in the HTML Tables Challenge. I think I'll review the lesson & start the HTML Tables Challenge over as I stopped in the middle of it & it makes me restart it fresh anyway if I log off for the day. When I discover what I did incorrectly, I'll post it.

Sounds good! if I may suggest that when you do post on the forum take a look at this page How-to Guide: Markdown within Posts this really helps students provide solutions much faster on the forum.

HTML Table Challenge Question 4: Not getting correct answer. Question 3 says: Add row inside table header. I inserted the <tr></tr> under my <tr><th>Food Groups</th></tr>. Question 4 says: Put 2 header cells with any text inside the row you just created. I get the "Bummer! Header cells must be inside of a table row & have text in them." Here's my HTML code:

<!-- Write your code below --> <table border="1"> <thead> <tr> <th>Food Groups</th> </tr> <tr> <th>Meat</th> <th>Dairy</th> </tr> </thead> <tr> <th>Fruits</th> <th>Vegetables</th> </tr> <tr> <td>Apples</td> <td>Carrots</td> </tr> <tr> <td>Bananas</td> <td>Potatoes</td> </tr> </table>

See the "Meat" & "Dairy" headers above. What am I missing? Thanks for your help.

Sorry. I'm not used to dealing with the Markdown area yet. Here's my markdown code:

<!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>Food Groups</th>
    </tr>
    <tr>
      <th>Meat</th>
      <th>Dairy</th>
    </tr>
   </thead>
    <tr>
      <th>Fruits</th>
      <th>Vegetables</th>
    </tr>
    <tr>
      <td>Apples</td>
      <td>Carrots</td>
    </tr>
    <tr>
      <td>Bananas</td>
      <td>Potatoes</td>
    </tr>
   </table>
  </body>
</html>

The <tr></tr> I added in response to HTML Tables Challenge Question 3 is after the "Food Groups" <tr></tr>. I then added the "Meat" & "Dairy" headers inside the <tr></tr>. I can't figure out what I'm doing wrong.

Hello Kathryn, sorry for the wait I was away for awhile. Ok, so I had to open a new workspace because the current workspace file was not working. I put in your code and from the headers Meat and Dairy. And I could see where you were trying to go for, I myself have not completed the HTML Basics course and may have confused you earlier. So from the HTML Basics course The first three minutes helped me, understand the structure of the code and why I could not create "columns" as I had hoped to. And instead created multiple rows however when stacked underneath each other they became columns:

<!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 colspan="4" >Food Groups</th>
    </tr>


    <tr>
      <th>Fruits</th>
      <th>Meat</th>    
      <th>Vegetables</th>
      <th>Dairy</th>
  </tr>

  </thead>


 <tbody>

       <tr>
      <td>Apples</td>
         <td></td>
      <td>Carrots</td>
         <td></td>
    </tr>

    <tr>
      <td>Bananas</td>
      <td></td>
      <td>Potatoes</td>
      <td></td>
    </tr>


  </tbody>

</table>
</body>
</html>

I hope this is what your were trying to accomplish! In the mean time I will complete the HTML Basics course if you have further questions.

I still don't have the correct answer for my HTML Tables Challenge Question 4--Put 2 header cells with text inside row just created.

The table row I created for Question 3 (without text) is underneath "Food Groups." That was a correct answer. I added the header cells "Meat" & "Dairy" inside that table row as an answer to Question 4, but I still get the "Bummer!" message as it's somehow incorrect & I'm not seeing my error. Should my "Meat" & "Dairy" be below "Fruits" & "Vegetables" outside the Table Header tags?

Table body is not required for this challenge. I read the instructors notes.

Nick@teamtreehouse.com

HTML Table Challenge - Question 4

Question 3: Add a row inside table header. (I inserted it under "Food Groups.") Question 4: Put 2 header cells with text inside row just created. (I inserted the "Meat" & "Diary" cells.) However, I get the "Bummer! Header cells must be inside of a table row & have text in them." What is my error?

Here is my code:

<!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>Food Groups</th>
    </tr>
    <tr>
      <th>Meat</th>
      <th>Dairy</th>
    </tr>
   </thead>
    <tr>
      <th>Fruits</th>
      <th>Vegetables</th>
    </tr>
    <tr>
      <td>Apples</td>
      <td>Carrots</td>
    </tr>
    <tr>
      <td>Bananas</td>
      <td>Potatoes</td>
    </tr>
   </table>
  </body>
</html>

Hey Kathryn, Well your post is getting real specific now, my best guess is that :

a) Question 3: Add a row inside table header. (I inserted it under "Food Groups.")

This looks good!

<thead>
    <tr>
      <th>Food Groups</th>
    </tr>
</thead>

b) Question 4: Put 2 header cells with text inside row just created. (I inserted the "Meat" & "Dairy" cells.)

Remember this is a header cell "<th>
this is a table header"<thead>"
and this is a standard or data cell "<td>"

I think that the challenge strictly asks that you continue from the previous challenge task and create header cells

<thead>
    <tr>
      <th>Food Groups</th>

     <th>Meat</th>
     <th>Dairy</th>
    </tr>
</thead>

So try moving your current table header cells into one table row Let me know how that works =)