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

What does it mean to, "Set the color of paragraphs to black using a hexadecimal value"?

I am confused. Was there a paragraph CSS element unique to altering the color of text in paragraphs? What am I forgetting?

2 Answers

James Barnett
James Barnett
39,199 Points

Was there a paragraph CSS element unique to altering the color of text in paragraphs?

You have to remember how CSS works. It selects an HTML element and then sets a CSS property.


So let's break this down into it's 3 parts:

  • HTML Element: A paragraph is <p>
  • CSS Property: color
  • Hexidecimal Color: black is #000000

Combine the 3 parts together into a CSS rule:

p { color: #000000; }
Erik McClintock
Erik McClintock
45,783 Points

Kelly,

The property that alters the color of text is the (somewhat ambiguously named) "color" property. So, to change the text color of a paragraph, using the hexadecimal value for black, you would write:

p {
    color: #000000;
}

The "p" is of course the element selector for all paragraphs, and then the "color" property targets the color of the text in those paragraphs.

Of course, alternatively for the hex value, you could truncate it to "#000" as allowed, but that's besides the point :)

Hope this helps!

Erik