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

How do I select an Image that's in a div?

I'm on a css coding challenge and need to select an image thats in a div with a class called "cupcakes" for a media query, please help!!

2 Answers

Classes are denoted in stylesheets by placing a dot (.) before their name. For example, if I wanted to select a div with a class called "cupcakes", I'd use this CSS:

.cupcakes {
    /* Styles here */
}

If you wanted to select an image element within the .cupcakes div, you could select it like so:

.cupcakes img {
    /* Styles here */
}

That would go inside your media query.

Hope this helps!

Nicely answered :cookie:

Thanks! :D

Thank you so much! It's the little things that get me. :P