color

To set color property values for an element.

Syntax

color: <value>;

The <value> can be the following:

  • Name of the color (e.g., aqua, khaki, red)
  • RGB colors (e.g., rgb(249, 2, 171))
  • Hexadecimal Colors (e.g., #ff0000)

Example 1

Set the h1 tag to be red color:

h1 {
color: red;
}

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn CSS on Codecademy

Contributors