color

Published Jul 7, 2021Updated Sep 3, 2021
Contribute to Docs

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;
}

All contributors

Looking to contribute?

Learn CSS on Codecademy