Understanding Hex Codes
|Base 10 (Decimal System)||Base 16 (Hexadecimal System)|
Example Hex Codes
Here are the actual hex codes for the 17 standard colors in CSS 2.1:
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.
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: