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

Victor De Jesus
Victor De Jesus
1,024 Points

Customizing Colors and Font (Challenge)

I think I am stuck in a very easy part of the CSS challenge. I asks me to set the color of paragraphs to black in hexadecimal values.

This is what I wrote:

p { color: #111; }

Is this wrong?

6 Answers

Chase Lee
Chase Lee
29,275 Points

Paul Barron, you don't need to use all six digits in a hexadecimal color code, what Victor used is a shortcut.

Victor De Jesus, you need to use #000 in your color code as it is the lowest number you can have, which is of course black.

Victor De Jesus
Victor De Jesus
1,024 Points

Thanks Chase. I forgot that the colors go from 0 to 9 and a to f.

Paul Barron
Paul Barron
6,595 Points

I mean yes. #fff is the highest amount of color. Remember in science they said white is full of color and black is the absence of color well... #fff is white and #000 is black and #999 is grey because it's in the middle grey area if you will. The hierarchy goes like this from black 01234569abcdef to white. hope this helps.

Ron McCranie
Ron McCranie
7,837 Points

You can use letters or numbers in the 3 character shorthand. All it says is if two consecutive numbers or letters are identical for that color (red, blue, green) then you can shorten it to 1. So #AABBCC -> #ABC and #EEFFAA -> #EFA

Here's a good article that goes into depth about hex colors and how to break them down.

http://www.smashingmagazine.com/2012/10/04/the-code-side-of-color/

Paul Barron
Paul Barron
6,595 Points

000000 hex=six you need 6 digits

Paul Barron
Paul Barron
6,595 Points

p { color: #000000; }

Victor De Jesus
Victor De Jesus
1,024 Points

So, when writing color in hexadecimal values, the only way to write them in 3 values is with letters. For example,

p {color: #fff;}

This will be white. Right?

Chase Lee
Chase Lee
29,275 Points

Correct. You can also do #384 which will equal #338844.

Chase Lee
Chase Lee
29,275 Points

Like in the example above, you can also write them in numbers.