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

CSS

Thomas Coler
Thomas Coler
8,068 Points

Code Challenge: Using Clases

I have been stuck for several hours on this challenge and can't understand why my code isn't working. The challenge requires you to first "Add a div around the featured-cupcake element, and give it the classes container and clearfix." and then "Add the classes grid_5 and omega to the featured-cupcake element."

Here is the code I have entered and I believe to be correct. I couldn't figure out how to get it in here any other way than linking to a picture of it through tiny pic. Can anyone offer me some help on this? Thanks!!!

http://tinypic.com/r/2epscx3/5

11 Answers

You have the grid_5 and omega classes added to the wrong div. They should be in the featured-cupcake div (the div with the id of featured-cupcake). Once you move the classes to the correct div, you'll be left with a div with no class and no id, so that div should be removed. Your result should have two divs, not three.

I think you may be a little confused about the difference between an id and a class. You can only assign a single id to an element, but you can assign multiple classes. An id is different from a class. An id is the identifier of the element. An element's class lets you define one or more css classes that define how that element looks. When the browser renders the element, it adds together all of those classes to determine what the element looks like.

For instance, imagine that the Earth is a web page and each person is an HTML element (like a div). A person's id would be their name. A person only has one name so they can only have one id. A person could have any number of classes that all define what they look like, such as "male", "tall", "blond". When you put all those classes together, they define what the person looks like.

To get back to your code, you want grid_5 and omega to be classes of the div element, not part of the id. It's perfectly fine (and in fact, common) for an element to have both an id and class.

Your end result should only have two divs. Since the question says to "add the classes grid_5 and omega to the featured-cupcake element", that means you'll have a div that has the id of feature-cupcake, and also has some classes. You can have an element that has an id and also has classes like this

<div id="ben" class="class1 classTheSecond thirdClass">

That example declares a div element that has the id "ben", and has the classes "class1", "classTheSecond", and "thirdClass". That's the kind of thing that this question is asking for for your featured-cupcake div.

The reason you have an error in your text editor is that <div="grid_5 omega> is incorrect HTML. You're not assigning grid_5 and omega to anything.

We've all wanted to smash our computer at some point. Best of luck :)

Thomas Coler
Thomas Coler
8,068 Points

Thanks for responding, Ben! Here is what I entered and it is now saying that the first step, "container clearfix" isn't passing. Any advice? Thank you, Tom.

http://tinypic.com/r/2z6zbwp/5

Thomas Coler
Thomas Coler
8,068 Points

This happens whether or whether not I link to the grid.css in the header.

Thomas Coler
Thomas Coler
8,068 Points

This happens whether or whether not I link to the grid.css in the header.

Thomas Coler
Thomas Coler
8,068 Points

Sorry, didn't mean to post that twice.

Thomas Coler
Thomas Coler
8,068 Points

Thank you for helping out here. I'm sorry I'm not getting what you are trying to teach me. I entered this and it didn't work.

http://tinypic.com/r/2q08uwo/5

Thomas Coler
Thomas Coler
8,068 Points

OH!!!! Ok! Thank you so much for the help, Ben! My head was about to explode earlier before you started answering my forum questions. You are a life saver! Best Regards, Tom