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 Structuring Tables The Table Foot Element

Shreyash Agarwal
Shreyash Agarwal
9,843 Points

Add colspan attribute to tr instead of td?

I think it's a better idea to add the colspan attribute to the tr element instead of the td element in a footer, considering we have only one element inside it.

Would this work?

Joe Rizza
Joe Rizza
8,513 Points

I'm confused- If you have a tr element with only one element inside it, isn't that one column? Why is colspan needed?

Maybe I misunderstood you. Can you please post some code to demonstrate what you are trying to accomplish?

Thanks!

2 Answers

Joe,

The table is a 3 column table, but you only have 1 column in your tfoot element.

You are right that in saying that a tr element with only one td cell in it is a single column.

What you cannot see, due to the styling of the table, is that you have a huge gap to the right where the td cells for the other 2 columns should be.

See codepen http://codepen.io/anon/pen/bdbabo

Now see the codepen with the colspan spanning all 3 columns: http://codepen.io/anon/pen/aOoEog

AR Ehsan
AR Ehsan
7,912 Points

colspan is needed to span the sentence like done in the video. It looks much better!