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

making an image disappear

i cant seem to get an image to disappear "display: none;" doesnt seem to work?

4 Answers

You need to use the "img" selector with class selector .cupcake to select all images inside of the cupcake div.

i tried, its still not working. what should i type because im just being extremely stupid now

.cupcake img {display:none;}

i did it backwards haha. thank you so much!!

You're welcome!

hi mate, im having the same trouble with this question now "Add the appropriate CSS within the same media query that will force the “love at first bite” illustration to disappear."

any help please?

img {
    display: none;
 }

Did you try that in your CSS file? Or associate it to the correct class or id?

i was doing it for the code challenge in adaptive design, implementing media queries, "Add the appropriate CSS code to the media query so that images within the ".cupcake" div disappear when the device or browser width is at most 480px wide." so i was using ".cupcake{ display: none; }

It's more than likely your selector choice. What does the html and css look like?

i was doing it for the code challenge in adaptive design, implementing media queries, "Add the appropriate CSS code to the media query so that images within the ".cupcake" div disappear when the device or browser width is at most 480px wide." so i was using ".cupcake{ display: none; }

You were selecting the entire div, but it only wants you to select the images inside of that div, so you'll have to adjust your css selector to match.

Also make sure that whole css block is inside of the appropriate media query.

how to adjust it properly?