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

Implementing Media Queries quiz task 3

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.

 /* Mobile ----------- */
@media screen and (max-width : 480px) {
     .grid_1,
     .grid_2,
     .grid_3,
     .grid_4,
     .grid_5,
     .grid_6,
     .grid_7,
     .grid_8,
     .grid_9,
     .grid_10,
     .grid_11,
     .grid_12 {
        width:100%;
          }
       .menu { width: 100%;
         }
      .contact { width: 100%;      
         }
     .cupcake{ display: none;
         }
 }

I have tried changing the .cupcake to #cupcake. I cannot figure out what I am doing wrong. Can someone please point me in the right direction

3 Answers

Hi Ian,

The key thing is "images" within the ".cupcake" div, rather than "the .cupcake div".

Your last selector, ".cupcake" hides the container for the images, but doesn't target the img tag itself. Try rewriting it to target the img tag?

James Barnett
James Barnett
39,199 Points
  • The goal is to write CSS that will select images inside of div the with the *class of cupcake.
  • Remember you want to select a class named cupcake not and ID.

If what I just mentioned is still confusing, now might be a good time to review CSS, with the CSS Foundations course.


It's worth noting that it's a common mistake for users new to Treehouse to go straight from the Build a Basic Website course to the Build a Responsive Website skipping over several foundational deep dive courses.

To see the order the courses were designed to be taken in, check out the Learn HTML & CSS Learning Adventure

Gentlemen, Thank you for your speedy responses.

James you are correct I am a new user and will be going back to do the deep dives. Thank you for the help.