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 trialJuan Carlos Hernández
8,316 PointsI 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
Stone Preston
42,016 Pointstry using max-width
instead of width
Rémi BRUGUIER
4,970 Pointsyou may want to try max-width instead of width ;)
Jimmy Hsu
6,511 PointsLogically 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.
Stone Preston
42,016 Pointswidth is a valid css property just fyi
Jimmy Hsu
6,511 PointsYup, I meant for just this case. I'll modify my answer to be more specific.