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 How to Make a Website Styling Web Pages and Navigation Make a CSS Image Gallery

I can't reach this code challenge

"Add CSS that will allow all images to fill their parent element."

I'm writing this : img{ width: 100%; }

Am I doing something wrong ?

3 Answers

try using max-width instead of width

you may want to try max-width instead of width ;)

Logically that would make sense, but CSS will have none of that in this instance.

img {
  max-width: 100%;
}

It's max-width and not just width to have images fill their parent. Just a quirk of CSS you'll come to remember.

width is a valid css property just fyi

Yup, I meant for just this case. I'll modify my answer to be more specific.