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


Why isn't my code for the custom colors working?

I am on challenge task 4 of 4, and can't seem to figure out what I'm doing wrong. I've added the 2.5% margin, which seems to have worked just fine. For the custom colors, however, I've added the following code, and it doesn't seem to be working.

#gallery li a p {
color: #000;
background: #fff;

The prompt keeps telling that it's incorrect, and to make sure I've set the colors to those of my choosing.

The validator might be expecting background-color instead of background? Sharing all the code you have will help us out a lot!

4 Answers

Ken Alger
Ken Alger
Treehouse Teacher


I don't see in the challenge where you need to select the anchor and/or paragraph tags in the gallery list items. That could be one issue. Also, as you move through the challenges, generally speaking, they require you to keep the code in place from previous challenge steps. So, all styling from tasks 1-3 should still be in place for task 4.

The code for the gallery list items I used for task 4 in the challenge was:

#gallery li {
  float: left;
  width: 45%;
  margin: 2.5%;
  color: white;
  background-color: purple;

That passed just fine. You can certainly put in other colors too.

Hope it helps.


Ken Alger
Ken Alger
Treehouse Teacher


The challenge "validator" can, at times, be extremely picky. Have you tried color: #000000 and background: #FFFFFF as your options? I know in reality your colors would work, but sometimes the challenge need more specific detail.

Also, in the future if you can include the specific challenge on which you are working as well as follow the Markdown Cheatsheet guidelines for including formatted code, it helps tremendously in the troubleshooting process.

Best of luck.

Hi guys,

Sorry for the delayed response, and thank you for your answers. I am on Stage 6, "Styling Web Pages and Navigation" and am currently on Challenge Task 4 of 4, which is asking me to:

"Add a margin of 2.5% to the gallery list items. Then, set the text color and background to colors of your choosing."

I have tried a number of things and in the preview the output is exactly as it should be. Unfortunately it's still not letting me progress.

Thanks everyone for your help. I think the problem was that I was using black and white as my colors, which, while the syntax was correct, wasn't actually changing anything at all.