View video tutorial

CSS Text Color

CSS

The color property is used to set the color of the text.

CSS color property.

➔ The color property determines the color of the text in an element.

Syntax

color: color | initial | inherit;

Property values

Value Description
color Sets the text color.
initial Sets the property to its default value.
inherit The element inherits the property value from its parent element.

Example

body {
  color: #101593;
}
h1 {
  color: #008070;
}
Try it Now »

Click on the "Try it Now" button to see how it works.


Sample Code

Copy each file contents and paste it to your own project and run to see the final output

Example

body {
  background-color: #d4d4d4;
  color: #2626d1;
}
h1 {
  background-color: #000000;
  color: #ffffff;
}
div {
  background-color: #0000ff;
  color: #ffffff;
}
Try it Now »

Click on the "Try it Now" button to see how it works.