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

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

I keep getting an error stating "bummer! it doesn't look like you set the maximum width on images yet.

the question asks: Add CSS that will allow all images to fill their parent element.

I inputted:

image{ max-width: 100%; }

I know that there is no parent element in CSS, so what should I do then? I have been looking for sources to help me out to give me insight to the problem or to just solve it.

Hey ! the selector for an image is img so you should try to use :

img {
 max-width:100%;
}

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Reza,

Without been able to see the challenge in question I would say the problem is because you have image instead of img which is the HTML tag for images.

img {
  max-width: 100%;
}
Reza Nadjmabadi
Reza Nadjmabadi
632 Points

thank you for clearing up the misunderstanding I had with img.

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

Thanks guys this really helped me. I owe you one. so I have to use img instead of image, is that because CSS recognizes this key word?

Chris Shaw
Chris Shaw
26,676 Points

In HTML the keyword img is the tag name for the element so this is what you always need to use to target it.