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

Creating a Website Structure CSS Using Classes

I am unable to figure out the code challenge which ask me to "Add a 'div' around the 'featured-cupcake' element and give it the classes 'container' and 'clearfix'." Can anyone help me and tell me what I did wrong?

<body>
  <div class="container" class="clearfix">
  <div id="featured-cupcake">
    <h2>Cupcake of the Week</h2>
    <img src="img/featured-cupcake.jpg">
    </d>
  </div>

12 Answers

Hey Lanz,

I can sure try and help you out. Can you please post a link to the challenge you are talking about along with the task that is giving you trouble.

Talk to you soon

Dan

Thanks Dan

Here's a link to the challenge code that I am having trouble with. http://teamtreehouse.com/library/using-classes

Thank you

Ok I see what you need to do. You need to create a div that will contain the other div with the id of "featured cupcake". Locate this div I just mentioned and you are going to create another div that contains it. Once you are created that div, give it the appropriate classes

Hope this helps. Let me know how it goes.

Dan

I'm sorry it still didn't work out for me. I am new to html and css and I don't fully understand what div I have to create inside another div and giving it the appropriate class. I watched the video over and over again but I am missing something.

Thanks

Ok I will show you an example of wrapping another div. The code below is an example div that is going to be contained by another div in a minute.

<div class="going to be contained">
<img>
</div>

I will now contain the div with another div.

<div class="container">
<div class="going to be contained">
    <img>
</div>
</div>

The div with the class "going to be contained" is now contained by the div with the class "contained"

Let me know if this helps :-)

Im still unsuccessful of solving it. Do you think you can show it in html terms? Like where to put them in another example.

Thank you

Can you tell me what I did wrong here?

< div class="container" class="cleearfix > < div id="featured-cupcake" > < h2 >Cupcake of the Week</h2> <i mg src="img/featured-cupcake.jpg" > < /div > < /div >

Lanz Ceniza I actually can't tell what you did wrong since you haven't posted your code here. Use Dan Ridley's example to figure out what it is you were missing.

You should arrive to this:

<div class="add-first-class-here add-second-class-here">
    <div id="featured-cupcake">
        <h2>Cupcake of the Week</h2>
        <img src="img/featured-cupcake.jpg">
    </div>
</div>

Replace "add-first-class-here" and "add-second-class-here**" with the respective classes

Happy coding :)

If I can remember right it should be this..

<div class="container clearfix">
  <div id="featured-cupcake">
    <h2>...</h2>
  </div>
</div>

Hope that helps

Joseph thank you so much for your help. It finally worked.

Lanz Ceniza Also when you find time you can step up your game by going through this comprehensive guide dedicated to helping beginners learn HTML and CSS

I will check it out to enhance my knowledge in html and css Joseph Wachira