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

alessio bortone
alessio bortone
2,291 Points

I need help with this challenge.. I am stuck!

-

what is the problem?

1 Answer

Lorenzo Pieri
Lorenzo Pieri
19,772 Points

Hi

#gallery { /*TASK 2*/
  list-style: none; /*No iist bullets*/
  padding: 0;
  margin: 0;
}
#gallery li { /*TASK 3 + TASK 4*/
  float: left;
  width: 45%;
  margin: 2.5%;
  color: lightblue;
  background-color: darkblue;
}
#gallery li img { /*TASK 1*/
  max-width: 100%; /*Filling the parent*/
}

Check this code out. It worked for me so it will also work for you :)

Have the best day!

Hi Lorenzo,

Task 1 is asking for css that will allow all images to fill their parent. Not just ones inside #gallery

img {
  max-width: 100%;
}
Lorenzo Pieri
Lorenzo Pieri
19,772 Points

Well, you are right without a doubt. We should tell this to the team at Treehouse because the solution I posted here does work on the challenge!

Nice catch bro!