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 Headers and Footers

Joseph Belanger
Joseph Belanger
1,988 Points

adding multiple tables?

when adding multiple tables using HTML, could you use the tags <table1> and so on? or would you have to assign an ID to each table?

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

No, you don't need to add id's to each table but each nested table should be inside a <table> tag or a table cell. TD tag. It's just about how you use the tags to get the nested tables on the screen. :-)

Joseph Belanger
Joseph Belanger
1,988 Points

so would using the tags [table1] and so on work as well?

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

I'm not sure what you mean. There's no <table1> <table2> tag etc. It's just table. All you're doing is making one table element a "child" of another. i.e. one element is inside the other.

As you suggested though you can name your elements with an ID. <table id = "table1"> </table>

This also provides a way you can select specific table elements with CSS.

Joseph Belanger
Joseph Belanger
1,988 Points

okay yes that is what i was trying to ask, adding an id will be for using css later on, but i was wondering if using the tag [table1] like we use with headers (h1,h2,h3) would save time and make it easier. but from what i understand, the answer is no and using an id is the way to go.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Yes, you're on the right track with ID's, but what I tried to say in my last post (but failed because I didn't use forum markdowns) is that table tags don't work the same way as the H1 to H7 tags. There's only one table element. :-)

Joseph Belanger
Joseph Belanger
1,988 Points

perfect. thank you for answering my question, you were very helpful !