Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Glen McAllister
Glen McAllister
3,878 Points

Creating structure code challenge fail

Hi - I'm just starting out with the HTML Learning adventure & I've already hit a snag. It's asking me to add an id attribute to a div element & it's failing me on even that simple task. My code is

<div id="featured cupcake"></div>

It complains with "Bummer - did you put the id attribute in the right element?".

Err…yes. Did you perhaps write a defective parser?

GAM

2 Answers

Not quite sure, but that way you define two ids for the element (featured and cupcake). Maybe you should use featured_cupcake or something like that?

Glen McAllister
Glen McAllister
3,878 Points

Yep - that was it - thanks. Glad it wasn't a defective parser after all. :)

GAM

Chase Lee
Chase Lee
29,275 Points

When you put a space between words when defining a class or and id like this: <div id="id#1 id#2"></div>, id#1 and id#2 are two different ids. The same is with classes: <div class="class#1 class#2"></div>, once again class#1 and class#2 are different. But you could keep going on with both. <div class="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 and_so_on"></div>1. Hope that helps.

Glen McAllister
Glen McAllister
3,878 Points

Thanks - yes - was using 2 ids instead of intended one. Error message wasn't exact, but hey - they rarely are… :)

GAM