CSS color Property

CSS color property sets the color of text in HTML Element(s).

The syntax to specify a value for color property is

color: value;

The following table gives the possible values that could be given to color property.

colorAny valid CSS color value.color: red;color: #f00;color: rgb(25, 220, 85);
initialSets color to default value.color: initial;
inheritInherits color value from its parent element.color: inherit;


In the following examples, we apply color to text in HTML Element(s) using different types of allowed values for color property.

color property with CSS Color Values

In the following example, we apply color property to paragraphs with different kinds of CSS color values. Refer CSS Color Values tutorial.


color property for a few HTML elements

In the following example, we take a few HTML elements like h1, p, a, span, and pre, and set text/font color for these HTML elements.



In this CSS Tutorial, we learned about color property, and how to use this property for HTML Elements, with examples.