CSS colours are defined using hexadecimal coding which is translated into an RGB colour value.

When using the CSS color element you can use many forms such as:-

  • color:red;
  • color:#FF0000;
  • color:rgb(255,0,0);

These styles can used for example as per examples below:-

CSS Code:

h1 { color: red; }
h2 { color: #FF0000; } 
h3 { color: rgb(255, 0, 0); }

This would result in folllowing results:-

This is a red h1 header.

This is a hexadecimal #FF0000 h2 header.

This is an rgb(255, 0, 0) h3 header.

Color Color HEX Code Color RGB
#000000 rgb(0,0,0)
#FF0000 rgb(255,0,0)
#00FF00 rgb(0,255,0)
#0000FF rgb(0,0,255)
#FFFF00 rgb(255,255,0)
#00FFFF rgb(0,255,255)
#FF00FF rgb(255,0,255)
#C0C0C0 rgb(192,192,192)
#FFFFFF rgb(255,255,255)