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

Ash Powell
Ash Powell
2,795 Points

I've set the color of the text and background, but the code isn't being accepted!

gallery li {float:left;width:45%;margin:2.5%;color:#000;background:#ccc}

Please can someone tell me why this isn't being accepted?

Where do you want to set your code for ? The code seem allright but you might just mess up with " gallery li" depends where you wanted it to set.

Ash Powell
Ash Powell
2,795 Points

Sorry that should be #gallery not just gallery - for some reason it's not showing correctly

Okay :) Remember that when you set and id in HTML and want to define it in CSS its" # ". Same for class but insted of # you must use a dot " . "

1 Answer

you're missing the hash tag in front of gallery..

#gallery li { ..... }

the hashtag identifies that you are selecting the tag with the ID gallery

Ash Powell
Ash Powell
2,795 Points

I do have that on my actual code, and when editing the main question again the # is there, when saved it disappears for some reason. It's definitely there on the actual code

it disappears because that symbol is ued to display code with other symbol so it disapears . Look somewhere how to put a code in treehouse . :)

you need to wrap your code in 3 back tick symbols before and after the code for it to show like mine.

As for the CSS it is correct so why it's not working I do not know.

Ash Powell
Ash Powell
2,795 Points

Ok thanks for the advice.. I'm not sure what the problem was but refreshing the page and then rewriting fixed it.

Thanks again everyone for your help