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

mitchell green
mitchell green
3,339 Points

Add the appropriate CSS code to the CSS to make images scale with the fluid layout.

Add the appropriate CSS code to the CSS to make images scale with the fluid layout.

im confused on what code to write. will someone help???

4 Answers

For an explanation:

Did you try going into preview mode and shrinking your browser width to see what happens to the image?

You'll see that the cupcake menu column shrinks in width but the image stays the same size and eventually the custom orders column will overlap the image.

They want the image to be able to shrink or expand along with the cupcake menu column that it is in.

By making the width 100% it will take up the width of its parent. It's basically saying, take up all the space that is available.

mitchell green
mitchell green
3,339 Points

Okay i think i understand it now. Thanks!

mitchell green
mitchell green
3,339 Points

okay so what about this:

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.

I typed the code: .contact { max-width: 100%; } .menu { max-width: 100%; }

and i get the error of: Did you add your code inside the media query?

You're close and the only mistake you might have made is where you placed it.

If you look towards the end of the styles you'll see that they have already setup the media query for you.

/* Mobile ----------- */
    @media screen and (max-width : 480px) {
      .
    }

Did you place your styles inside that media query?

Also, you can use width instead of max-width.

mitchell green
mitchell green
3,339 Points

i figured it out but thanks for your help any ways:)

You're welcome

  img {
    max-width  : 100%;
    height : auto;

This will work too.

img {
width: 100%;
}

This will work too.

img {
width: 100%;
}

Sorry for the double post. Editing a comment seems to be a little messed up.

mitchell green
mitchell green
3,339 Points

thanks jason

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.

can you help me with this too.

mitchell green
mitchell green
3,339 Points

okay i think i understand now. Thanks!