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

Stuck on: making a div img "disappear" for media qry

I'm stuck on the quiz under Adaptive design; Implementing Media Queries. The question is

Add the appropriate CSS code to the media query so that images within the "cupcake" div disappear when the device or browser is at the widest 480px.

Unless I missed something, I didn't remember the teacher illustrating that. In any event, I went under the media query and put:

@media screen and (max-width:480px){
#img .class {
display:none;
max-width: 100%;
}

I went through a bunch of different scenarios but kept getting the error message "Bummer! image is still viewable below 480px" Any thoughts on that?

4 Answers

It's asking for images inside of the cupcake div, which I am assuming is a class of cupcake. So something like

.cupcake img { }

If it's an ID, than it's a hashtag instead of a period before cupcake.

I tried this when I went through, which seemed to work:

.cupcake img { display: none; }

Rob Cachia - Don't just provide the answer to a problem when someone else is in the middle of helping! Remember our goal here on the forum is give help not answers, next time try giving an explanation and/or a hint instead.

Need more explanation on the distinction check this out.

Oops, not posted on here before – need to brush up on the rules :)

My thanks to Rob, it worked. James I couldn't agree more with you. I don't want to be simply fed the answers but, as I described in the issue, I don't remember seeing an illustration about that CSS code. If I'm expected to know the material, I should at least be provided with at least similar example. If I was that adept at the material I would have never even joined.

The Build a Responsive Website is an intermediate course it looks like you skipped over the CSS Foundations course. I'd suggest you follow along with the Learn HTML & CSS Track

N.P. Rob & a debt of gratitude to you. What James and the other moderators are trying to foster is relying on the rationale/logic born out of what you've been taught. It's actually my fault because somehow or another I completely skipped a phase. Had I not done that, the answer would have been apparent. In the future, it's encouraged to present the formula and the logic to the answer but let the student take that and play it out to its end resulting in the answer. That way you've demonstrated that you know what you're doing, and they feel good about the fact that they resolved the issue themselves with your help. Sorry to be so long winded.

Chris Mursheno - I couldn't have said it better myself :smile: