Colors

Colors


The CSS color property sets the text color:

h1 {
color: aqua;
}

It can be set with one of the following:

  • Name keywords: aqua
  • Hexadecimal: #00ffff
  • RGB value: rgb(0, 255, 255)
  • HSL value: hsl(180, 100%, 100%)

Color name keywords can be used to set color property values for elements in CSS. All browsers support the following:

| Keyword | Hexadecimal | |

Colors

color
To set color property values for an element.
hsl()
Defines the color by providing the hue value, saturation value, and the luminance value.
hsla()
Defines the color by providing the hue value, the saturation value, the luminance value, and an optional alpha value (transparency).
opacity
To measure of how transparent an element is.
rgb()
Defines the color by providing the red value, the green value, and the blue value.
rgba()
Defines the color by providing the red value, the green value, the blue value, and an optional alpha value (transparency).
Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn CSS on Codecademy