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

HTML How to Make a Website Customizing Colors and Fonts Write Hexadecimal Colors

how do I Set the color of paragraphs to black using a hexadecimal value

how do I Set the color of paragraphs to black using a hexadecimal value?

css/main.css
a {
  text-decoration: none;
}

#wrapper {
  max-width: 940px;
  margin: 0 auto;
}

#logo {
  text-align: center;
  margin: 0;
}

a {
  color: #6ab47b;
}

header {
  background: #6ab47b;
  border-color: #599a68
}

h1, h2 {
  color: #fff;
}

nav {
  background: #599a68;
}

nav a.selected, nav a:hover {
  color: #32673f;
}

body {
  background-color: #fff;
  color: #999;
}

2 Answers

p {
    color: #000000;
}

p corresponds with the paragraph element. The hex value for black is #000000. Since it is using the same number you can also write #000 for the value in CSS.

Hope this answers your question!

Alex Flores
Alex Flores
7,864 Points

What juliankennon said is one way of doing it and here's another:

p { 
  color: rgb(0,0,0);
}

Either way works here and I don't believe either one provides any benefit over the other. I find that using rgb is easier for inline scripting and an easier concept to understand, as it uses base 10 rather than base 16. However, it rarely matters as I still just use online websites like css color pickers like http://www.w3schools.com/tags/ref_colorpicker.asp

Cheers!

Thank you, friend