If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

CSS: The color property

The color property changes the text color. Colors can be specified in several ways:
nameEvery browser knows 16 common color names.red
rgb()A triplet of values from 0 to 255, representing the Red-Green-Blue color spectrum.rgb(255, 0, 0)
rgba()Like rgb(), but with a fourth value representing the opacity, ranging from 0 to 1.rgba(255, 0, 0, 0)
hexA hexadecimal number representing the R-G-B triplet.#FF0000
This property is "inherited", which means it'll also be applied to all descendant elements but can be overridden by more specific rules.

Want to join the conversation?

No posts yet.