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

Hi could u please help ?

I don't know where should I put the table cell exactly?

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

    <!-- Write your code below -->
    <table>
      <tbody> <td>IM COOL AS FUCK</td><tr> </tr> </tbody>
      <thead> <tr> <th>Yo</th>
        <th>What up</th></tr> 

        <tr> 
<th colspan="2" >
          </th>
        </tr>
</thead>
 </table>

  </body>
</html>

1 Answer

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Andrew,

A general html table structure looks like this:

<table>

            <caption>Title</caption> <!-- Optional, but must immediately follow the table tag -->

            <thead>

                <!-- Headings go in this section --> 

                <tr>

                    <th>Column Heading One</th>

                    <th>Column Heading Two</th>

                    <th>Column Heading Three</th>

                </tr>

            </thead>

            <tfoot>

                <!-- Also Optional, but comes before the tbody tag -->

            </tfoot>

            <tbody>

                <tr>

                    <td>Cell 1, Row 1</td>

                    <td>Cell 2, Row 1</td>

                    <td>Cell 3, Row 1</td>

                </tr>

                <tr>

                    <td>Cell 1, Row 2</td>

                    <td>Cell 2, Row 2</td>

                    <td>Cell 3, Row 2</td>

                </tr>

                <tr>

                    <td>Cell 1, Row 3</td>

                    <td>Cell 2, Row 3</td>

                    <td>Cell 3, Row 3</td>

                </tr>

            </tbody>

</table>

Remember to put your thead tag above your tbody tag since headings generally go above the data in tables.

Good luck with the project!

Hi Daniel,

I think the caption should be placed before the thead:

<caption>your caption</caption>
<thead>... </thead>
Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Gregor,

You're right, the caption has to immediately follow the table tag. Good eye!