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

Kari Gregorich
Kari Gregorich
3,048 Points

Can't style my <h2>

Can't change the color of my level 2 header with css - is my code wrong? My other headings are responding to the changes; just not this one:

<div id="featured-cupcake" class="grid_7"
        <h2>Cupcake of the Week</h2>
        <p>This week's featured cupcake is the <a href="#">Avocado Chocolate Cupcake</a>.  It's strange combo of flavors will kick your taste buds into fiesta mode!</p>
        <img src="PROJECT/Images/featured-cupcake.jpg" alt="Avocado Chocolate Cupcake">
</div>

6 Answers

<div id="featured-cupcake" class="grid_7"

Should be

<div id="featured-cupcake" class="grid_7">

You didn't close the div.

Kari Gregorich
Kari Gregorich
3,048 Points
            <p> <div id="featured-cupcake" class="grid_7"
        <h2>Cupcake of the Week</h2>
        <p>This week's featured cupcake is the <a href="#">Avocado Chocolate Cupcake</a>.  It's strange combo of flavors will kick your taste buds into fiesta mode!</p>
        <img src="PROJECT/Images/featured-cupcake.jpg" alt="Avocado Chocolate Cupcake">
      </div></p>
            ``` 
Ken Delaney
Ken Delaney
1,363 Points

Not sure why you would want to have your div inside of a <p> but regardless; to style your h2 only for the #featured-cupcake div you would simply target those h2 in CSS like this #featured-cupcake h2 {color: #fff;} if you want to change all h2 color you just need to h2 {color: #fff;}.

Kari Gregorich
Kari Gregorich
3,048 Points

Thanks Ken. I'm just following along with the lesson, but knew I forgot something when all my h2s didn't change color.