CSS Almanac

Home » CSS Almanac » Properties » C » color

color

The color property in CSS is specifically for controlling the color of text.

p {
  color: green;
}

I'm an example of the above CSS taking effect on a specific paragraph.

You can use any color value, for instance:

#f00
#ff0000
rgb(100,100,100)
rgba(100,100,100,0.5)
hsl(20, 100%, 50%)
hsla(20, 100%, 50%, 0.5)
named colors

The color property does cascade. So for instance if you set it on the body, all decedent elements that don't have their own color set in the user agent stylesheet will inherit that color.

Browser Support

Chrome Safari Firefox Opera IE Android iOS
any any any any any any any

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~