Color Values


RESETRUNFULL
<!DOCTYPE html><html><head>
<style>
   body {background: green;}
</style>
<body></body></html>

A CSS color can be specified in several ways:

  1. By #RGB HEX, eg. #0F0
  2. By #RRGGBB HEX, eg. #00FF00
  3. By decimal RGB, eg. rgb(0,255,0)
  4. By decimal RGBA, eg. rgba(0,255,0,0.3)
  5. By % RGB, eg. rgb(0%,100%,0%)
  6. By % RGBA, eg. rgba(0,100%,0,0.3)
  7. By HSL, eg. hsl(120,40%,70%)
  8. By HSLA, eg. hsla(300,40%,70%, 0.5)
  9. By Name, eg. green

'RGB' is an acronym for Red-Green-Blue.
'HSL' is an acronym for Hue-Saturation-Light.
'A' refers to the alpha channel and can range from 0(fully transparent) to 1(fully opaque).

The color names are case-insensitive: