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 trialCarson Clark
2,159 PointsWhy won't this work?
Could somebody possibly tell me why this won't work. What exactly is a "cell"? Isn't it the same as a row? I'm missing something! Thanks.
4 Answers
jaredcowan
11,808 Points<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<thead>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
jaredcowan
11,808 Pointsa table cell is <td>
Catalin Sucigan
15,563 PointsMore specific, a table is divided into rows with the <tr> tag (as you know). A row is divided into data CELLS with the <td> tag. Too late anywayz :D
Jason Anello
Courses Plus Student 94,610 PointsHi Carson,
Table cells are either <td>
data cell or <th>
header cell
Your content is going to be inside those elements.
Tables have very specific rules about what elements can go where and in what order.
td's and th's must be contained within tr's. So a <tr>
element can contain zero or more th
's or td
's
In your screenshot you have two problems. Your <thead>
can't contain <th>
children. The <th>
's must be contained within a <tr>
Also, you have placed text directly inside the table row's in your tbody
section. The table rows need to contain table cells and then those cells can contain your text.
The spec isn't the easiest thing to read but this link contains the full rules for how these elements have to be used.
http://www.w3.org/TR/html5/tabular-data.html
Near the beginning of each subsection you will see Contexts in which this element can be used: and Content model: These two parts tell you where to put the elements and also what can be inside them.
Carson Clark
2,159 PointsCarson Clark
2,159 PointsThat doesn't really answer my question.