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!
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
Sarah Bierman
226 PointsWhat am I doing wrong? Code Challenge: Creating Structure. Question 2
It says Add an id of 'featured-cupcake' to the 'div' you just created.
<div>id='featured-cupcake'>
</div>
<div>id="featured-cupcake"></div>
WHAT AM I DOING WRONG? AND HOW DO I CHECK THE ANSWERS?
8 Answers

austenpayan
10,218 PointsHello Sarah. It looks like you are declaring the id outside of the div tag instead of inside of it.
It should look like:
<div id='featured-cupcake'></div>
Hope this helps!

Scott Sheldon
6,942 Points<div id="featured-cupcake">
</div>
Your id needs to be declared within your first div tag, and it needs to be surrounded by double quotes.

Sarah Bierman
226 PointsHow do I answer the question correctly? What do you mean correct id attribute? How does one get a correct id attribute? The specific code challenge instructions state,"Add an id of 'featured-cupcake' to the 'div' you just created. Am I correct in thinking that "featured-cupcake" is the id and therefore the correct answer is <div> id='featured-cupcake'></div> ?

John Hedge
1,879 PointsThe id attribute can be named whatever you want providing it follows javascript naming conventions. So <DIV ID="featured-cupcake"></DIV> should work unless there's are more specifics to the code challenge. Could you type in the exact instructions of the code challenge and the sample code that is there?

Jacob Miranda
19,073 PointsUse double quotes and put the id attribute in the div element.

John Hedge
1,879 PointsCorrection as long as it follows html naming conventions

John Hedge
1,879 PointsCorrection as long as it follows html naming conventions

nik
8,925 PointsHi Sarah,
first off this format is wrong
<div>id='featured-cupcake'>
</div>
<div>id="featured-cupcake"></div>
Austen gave you the correct format to write not the exact answer pertaining to the code challenge itself.
So looking at the code challenge it's asking you to add an ID of featured-cupcake to the div that you just created.
Locate that div, it should look something like this:
<div>
<h2>Some text here</h2>
<img src="some pic file.here">
</div>
Now add the id of "featured cupcake" to that div and you should be fine. =)

John Hedge
1,879 PointsCorrection as long as it follows html naming conventions

John Hedge
1,879 PointsSorry - I hit update too many times!
Sarah Bierman
226 PointsSarah Bierman
226 PointsThanks, I copy and pasted your code and I got this answer-Bummer! Did you put the 'id' attribute on the right element?
austenpayan
10,218 Pointsaustenpayan
10,218 PointsThe answer I provided was pertaining to the correct practices of using the id attribute, if there is a specific code challenge you are trying to answer you will have to apply the correct id that the challenge is asking for.
As long as you declare the correct id attribute inside the div tags, you should get the correct answer. Good luck!