Web Colors

Web Colors Using CSS
We have set our text and background colors using actual color names, such as:
name-color

RGB Colors
To build custom colors, we mix specified amounts of the additive primary colors of red, green, and blue (often abbreviated as RGB).
rgb256-color

RGB Hex Codes
We specify the mixtures of red, green, and blue by using what is known as a Hex code:
hex-code hex-code-note

Understanding Hex Codes

Base 10 (Decimal System) Base 16 (Hexadecimal System)

hex-code-base16 base16-note

Example Hex Codes
Here are the actual hex codes for the 17 standard colors in CSS 2.1:
hex-colors
As we study these hex codes, we can begin to see the logic of mixing lower and higher amounts of red, green, and blue to result in the given color.
hex-color-note

Finding Hex Codes
Many applications and websites offer tools to help us find and select  color codes.  Colorpicker.com is a free website and very simple to use:
color-picker

Using Hex Codes in CSS
Let’s use the Hex code we just generated from the color picker website and set it as the background color for a <div> element.  We’ll set a different, contrasting color for the text:
hex-example hex-example-note