Smal SEO Tool

CSS Colors

Colors in CSS can be specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values.

CSS Color Names

CSS supports 140 standard color names. You can use these names directly in your styles.

Example

css
h1 {
  color: Tomato;
}
p {
  color: DodgerBlue;
}
Try it Yourself »

RGB and RGBA Colors

RGB stands for Red, Green, and Blue. An RGB color value is specified with: rgb(red, green, blue). Each parameter defines the intensity of the color from 0 to 255.

RGB Example

css
h1 {
  background-color: rgb(255, 99, 71);
}

RGBA color values are an extension of RGB with an alpha channel (opacity). An RGBA color value is specified with: rgba(red, green, blue, alpha). The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).

RGBA Example

css
h1 {
  background-color: rgba(255, 99, 71, 0.5);
}

HEX Colors

A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color.

HEX Example

css
h1 {
  background-color: #FF6347;
}

Test Yourself with an Exercise

Which color format includes an alpha channel for transparency?