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

css not working

i don't know what i'm doing wrong, but my css is not working. here's my code:

#gallery li {
  float: left;
  width: 45%;
  margin: 2.5%;
  background-color: #f5f5f5;
  color: #bdc3c7;
Richard Duncan
Richard Duncan
5,568 Points

What's the question I can't see anything wrong witht he syntax.

yes, that's what I thought, but all my images are jumbled up. I don't know where I'm going wrong. I don't think it's a browser issue either.

Richard Duncan
Richard Duncan
5,568 Points

Is this a code challenge? cecil quist if so post the question and I'll see if I can help. If it's a personal website query post what you want the end result to be please.

James Barnett
James Barnett
39,199 Points

cecil quist -

I'd suggest you make a codepen and then post the link in this thread. Make sure to include all of your HTML & CSS in the pen (on codepen) so we can see the bigger picture.

If I had to take a random guess, your HTML has an issue, and doesn't match up exactly with Nick's.

5 Answers

Nick Pettit
Nick Pettit
Treehouse Teacher

Hi cecil quist,

On line 19 of your CSS, you have a bad selector. Your selector says "image" when it should be "img" instead. Here's the corrected code:

img {
  max-width: 100%;

I've forked your pen and added the hosted versions of the image assets (from treehousewebsite.com) so you can see what the correction should look like: http://codepen.io/nickpettit/pen/ajqhA

Hope that helps!

No it's not a code challenge, it's a practice code on "how to build a website" with Nick Pettit. "style the portfolio" I don't know if you can open this link, but here it is... thanks.


Richard Duncan
Richard Duncan
5,568 Points

Quite a lot going on here and I don't have time right now to watch the vid, have you tried re-watching it see if it makes more sense the second time around?

yes I have over and over to where it was last perfect. I will give it another shot. thanks.

Thanks James. Here's the cod in Codepen




Thanks Nick. Phew!