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

General Discussion

Code Challenge 1/4

It asks: "Add CSS that will allow all images to fill their parent element. But it keeps telling me that "Bummer! It doesn't look like you set the maximum width on images yet. But the answer I put was: " img { max-width:100% } Please help.

6 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Do you need to set the selector for the parent element too?

Failing that, add your semi colon to your max width. img {max-width: 100%;}

Thank you for the response and it worked. I have one more question, the next step asks me too, "Select the element with the ID gallery. Then, remove the margin, padding, and bullet points." The code that I wrote was,

id {

margin: 0; padding: 0; list-style: none;} But it tells me, "Bummer! It looks like at least one side has no margin. Be sure you set all sides to zero margin." Can you please help me again. I will highly appreciate it thanks.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,254 Points

Try adding px to your padding value so it would be padding: 0px; and margin: 0 auto;

It could also be that it wants all specific sides of your margin so margin: 0 0 0 0;

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Do you need to set the selector for the parent element too?

Failing that, add your semi colon to your max width. img {max-width: 100%;}

Thank you again for the help but the same error keeps popping up. I tried both of the methods and it is still not working. Is there any other method that you have that might make it work?

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

Without seeing all the code, my best guess is you need to look at your selector making sure it's correct.

#gallery {
margin: 0; padding: 0; list-style: none;}
}

Look make sure in your index.html tab in the challenge that you have an element with the id gallery.

Thank you so much for the help. It worked this time and I appreciate you taking the time to answer my question.

thanks jonathan passed it at last.