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

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