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

John Quinn
John Quinn
1,318 Points

HTML/CSS. Need help on image list item!

Making my first website and my images on my home page seem to not respond correctly. There are white squares next to each image and it is making my text be centered from both the image and white square. I have to get rid of the white parts next to the images and center the text under the image. This is my code for css:

#gallery {
  margin: 0;
  padding: 0;
  list-style: none;
  }
#gallery li {
  float: left;
  width: 50%;
  margin: 2.5%;
  background-color: #f5f5f5;
  color: #afbfb7;
  }
#gallery li a p {
  text-align: center;
  margin: 0;
  padding: 10px 0;
  margin-top: -4px;
  font-family: 'Lato', 100italic;
  font-size: 0.9em;
  color: #afbfb7;
  }
#gallery img {
  width: 50%;
  }

1 Answer

Andrew Shook
Andrew Shook
31,709 Points

Try:

.gallery img{
    width: 100%;
}