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

tables

I try to complete the code but this message comes up: Bummer make sure to have two header cell with text in them. What is wrong?

  <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>
      <th></th>
    </tr>
    <tr>
      <td>Apples</td>
      <td>Carrots</td>
    </tr>
    <tr>
      <td>Bananas</td>
      <td>Potatoes</td>
    </tr>
</table>

your welcome

3 Answers

The <th> tag is the row's header or title. As such, you would only want the title on the top row of the table. So for the first row you'd want to use the <th> tag while on the rest the regular <td> tag. Like this:

<table border="1">
<thead>
<tr>
 <th colspan="4">Food Groups</th>
</tr>
 <tr>
<th>Meat</th>
  <th>Dairy</th>
 <th>Fruits</th>
 <th>Vegetables</th>
</tr>
 </thead>
 <tr>
  <td>Apples</td>
  <td>Carrots</td>
 <td>Bananas</td>
   <td>Potatoes</td>
  </tr>
 </table>

Also, you only have one column, called "Food Groups" which I assume you want to span over all 4 columns. If that's what you want to do, you add the attribute colspan.

http://codepen.io/anon/pen/ghjek

The list is unsorted as you can see, but the layout should be as you want it.

Put 2 instead of 1

Put 2 instead of 1