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!

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

HTML How to Make a Website Responsive Web Design and Testing Responsive Web Design

Matthew Keys
Matthew Keys
1,922 Points

Help with "max-width: 100%" for img.

I am confused by the img {max-width: 100%"}. I do not understand what it means. Does it make it so that the size cannot go above 100% of its original size or what?

2 Answers

when you set the img max-width to be 100%, the maximum width of the img element is 100% of its parent element's width. This also means the image will scale eg. be responsive when the window is resized.

Sandra Norris
Sandra Norris
3,895 Points

I think it is well explained here https://www.impressivewebs.com/width-100-percent-css/ if you would like to see.