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
Austin Rau
Courses Plus Student 8,019 PointsHow 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
Matthew Mascioni
20,444 PointsClasses 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!
Austin Rau
Courses Plus Student 8,019 PointsThank you so much! It's the little things that get me. :P
James Barnett
39,199 PointsJames Barnett
39,199 PointsNicely answered
Matthew Mascioni
20,444 PointsMatthew Mascioni
20,444 PointsThanks! :D