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

images not lining up correctly

I'm on the section about floating images supplied by Nick. The 1st and 2nd images are side by side, but there's an empty space to the left of the 3rd image (image-number 6). The 4th (image 9) and 5th (image 12) images are side by side, The 3rd and 4th images should be side to side with the 5th by itself. Is there something wrong in my html or css? I can't seem to get my html to load on here.

Here's the css

gallery {

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

gallery li{

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

}

Here's how to post code in the forums: https://teamtreehouse.com/forum/posting-code-to-the-forum

3 Answers

are you missing a space in float: left;

Spaces after the colon are strictly for readability. It make no difference to the browser.

Ha! Thank you!

Adam Moore
Adam Moore
21,956 Points

I didn't know that the space didn't matter; I hadn't really run across not putting spaces, as I put a space out of habit and I didn't check it myself to see if the space mattered.

Adam Moore
Adam Moore
21,956 Points

The CSS you have here looks right, and should put the list items side by side, two per line. If they are not showing up correctly, then there may be some problem with some other HTML or CSS settings that is throwing off the alignment. It may even be something as small as leaving off a closing "/" mark.

Adam Moore
Adam Moore
21,956 Points

Crap, yeah, Brian, you are right, I missed that. :)

haha, no problem. Cheers Adam