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.

ColorColor HEX CodeColor RGB
#000000rgb(0,0,0)
#FF0000rgb(255,0,0)
#00FF00rgb(0,255,0)
#0000FFrgb(0,0,255)
#FFFF00rgb(255,255,0)
#00FFFFrgb(0,255,255)
#FF00FFrgb(255,0,255)
#C0C0C0rgb(192,192,192)
#FFFFFFrgb(255,255,255)