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 Build a Responsive Website Adaptive Design Implementing Media Queries

Brenda Kittles
Brenda Kittles
1,512 Points

Challenge Task 2/3

I have no idea why I am getting the error: Did you add you code inside the media query? I am new to this, what did I miss?

The task is to add the appropriate CSS code to the media query so that ".contact" and ".menu" fill the entire container width when the device or browser width is at most 480px wide.

 /* Mobile ----------- */
    @media screen and (max-width : 480px) {
    .contact {
      max-width: 100%;
      }
    .menu {
      max-width: 100%;
      }
    }

3 Answers

Hi Brenda,

Technically your code looks OK to me but I think this is what the code challenge is looking for:

    /* Mobile ----------- */
    @media screen and (max-width : 480px) {
      .contact,
      .menu {
        width: 100%;
      }
    }

And by the way, the back-ticks are above the tilde ~ key.

Jeff

Hi Brenda, You are very close. I think the right code should be this:

@media screen and (max-width: 480px) {
  .contact,
  .menu {
    width: 100%; 
  }
}

Basically, you need to use the standard width property, instead of the max-width property. Please let me know if it worked.

Cheers, Carsten

James Barnett
James Barnett
39,199 Points

Guil Hernandez - Why does is work with width but not max-width here? Does it have to with max-width not being inherited or is there something else I don't understand about max-width?