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 Style the Portfolio

Nathan Noye
Nathan Noye
4,370 Points

Why is there a gap after the second photo when I use float: left;?

I followed the course and checked my code even googled for an answer but came up with nothing. Im doing something wrong but I can't find the answer. After my second photo on my site, I get this space another picture should be but nothing is there BUT the picture that should be there has moved over to the other spot. Any clue why it would do this?

Hugo Paz
Hugo Paz
15,622 Points

Hi Nathan,

Can you please your code here so we can help?

Nathan Noye
Nathan Noye
4,370 Points

img { max-width: 100%; }

gallery {

margin: 0;
padding: 0;
list-style: none;
      }

gallery li {

float: left;
width: 45%;
margin: 2.5%;
background-color: #f5f5f5;
color: #bdc3c7;
     }

Thanks for the quick answer man!

5 Answers

Hugo Paz
Hugo Paz
15,622 Points

Nathan,

Try reducing the margin to 2% and adjust accordingly.

Saad Ahmed
Saad Ahmed
7,090 Points

Also if you can attach a screen shot of the webpage. I personally had the same problem in the beginning but its probably just the margins.

Nathan Noye
Nathan Noye
4,370 Points

How would I post a picture on here? I tried dragging and dropping but unfortunately had no luck

Saad Ahmed
Saad Ahmed
7,090 Points

try using this in the comment box: alt text

Nathan Noye
Nathan Noye
4,370 Points

I can't see what you posted :/