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 Customizing Colors and Fonts Write Hexadecimal Colors

Paragraph color to black?

Is this question asking to change the paragraph (body) text to black or the background color? I've tried everything and it's saying I got the question wrong...

12 Answers

Julian Ptak
Julian Ptak
30,920 Points

Hey boss,

Couple possibilities right off the bat... I can't see the question so I'm just spitballing based on your post.

First check your hex value. #000 is shorthand for black. #000000 is longhand for black. I remember it like this... "Black is 'no color' or 'nothing' so I pass a value of 'nothing' or a bunch of zeroes as the hex value.

Second, check the amount of zeroes. Hex codes need 6 values. You can only get away with three if you're trying to duplicate the same value over two spots. So the first zero counts for two spots, the second zero counts for two spots, and so on.

Third, check your selector. "p" will select all paragraphs. "body" will select the whole body. I can't tell based on your question what exactly you're trying to change so perhaps a little more info would give me the tools I need to answer you more concisely.

Fourth, check your property. "background: #000" will set the whole background behind the text or images or what-have-you to black. "color: #000" will change just the text to a color of black.

Therefore the following would change the background of a paragraph to black:

p {
   background: #000;
}

And the following would change the font color of all the text in the body to white:

body {
   color: #fff;
}

I hope that helps. :)

It's looking for the text color. But also be sure to use HEX values, and not just the black predefined color.

p {
  color: #000;
}

Thanks! p was a new one - had only used body, nav and h1, h2 in the videos :)

Indeed, I am also new, and this is quite a learning curve. First, thank you Rob for stepping forward with the question, so that its right out here and easy to find, and second, thank everyone else for being so helpful. :) You all are great, and you are helping me learn more than you know. (Actually, you all were here before, so you do indeed know, haha) Thanks again, everyone.

Also, as a side note: New people: try not to get frustrated. They threw this at you to be sure you know what you are doing, and it is a very proactive teaching method. :) trust these guys on the forums :) they are only here to help.

background-color is for the BACKGROUND, the stuff behind the text. If you want to change the color of the text the rule is color, not background-color.

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

wait why is it p{

color: #000;

}

and not the other one?

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

oh woops i just saw your comment okay cool i get it now thank you so much

Hi Rob,

If the question below is what you're referring to then in the css they want you to select the p element, p { }, and set it's color to black.

Set the color of paragraphs to black using a hexadecimal value.

Had the code challenge wanted the background color set it probably would have been worded as follows: Set the background color (or just background) of paragraphs to black using a hexadecimal value.

Jeff

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

Yeah i am getting the same error, but it comes back and says "Double check that you've styled paragraph (p) elements to be black with a hexidecimal value." I used the long hand way:

p{ background-color: #000000; }

is this correct?

Julian Ptak
Julian Ptak
30,920 Points

Check the answers above for all the help you need.

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

I did it keeps giving me the same error

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

do you think it's space sensitive?

Julian Ptak
Julian Ptak
30,920 Points

Try "background" instead of background-color.

I think you're confusing the two properties.

no no no

p {
  color: #000;
}
Reza Nadjmabadi
Reza Nadjmabadi
632 Points

yeah I dunno what i am doing wrong i've been looking around and viewing tutorials they all say the same thing. I guess i do not understand the question.

Question: "Set the color of paragraphs to black using a hexadecimal value."

response: p{

background-color: #000000;

}

Reza Nadjmabadi
Reza Nadjmabadi
632 Points

I also followed your suggestion and it still came back wrong would it matter if i did it long handed vs short handed? like for example if my h1 and h2 where used short handed then I would have to use short hand for my paragraph background color, right?

Julian Ptak
Julian Ptak
30,920 Points

Try just the color property like someone suggested just now. Look above at the comments.

p { color: #000000; }