A Deeper Look at Color

When you tried the color and background-color attributes to style your html code, did you find some color names that didn't work? What happens if you try a color like 'hotpink'? or 'neonyellow'? or 'bluegreen'? And how does the computer know what we mean by these color names, anyway? The answer is hexadecimal!

All colors are actually coded for the computer using hexadecimal number codes. Let's see how the hexadecimal number system works and then we'll see how it relates to web colors.

The Hexadecimal System

The easiest way to understand the hexadecimal system is to compare it to the number system you already know - the decimal system.

Decimal System

Hexadecimal System

we use ten different digits to denote values from 'zero' to 'nine'

uses sixteen different digits to denote values from 'zero' to 'fifteen'

the digits are  0 - 9

the digits are 0 - 9 and A - F

we count single digit numbers:

0 1 2 3 4 5 6 7 8 9

we count single digit numbers:

0 1 2 3 4 5 6 7 8 9 A B C D E F

and two-digit numbers:

10 11 12 13 14 15 16 17 18 19 20 . . . 99

and two-digit numbers:

10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 . . . FF

the largest two digit number:

99

represents the value 'ninety-nine'

the largest two digit number:

FF

represents the value 'two hundred fifty-six'

It's not critical for you to be able to convert values between decimal and hexadecimal notation; but knowing that FF represents 'two hundred fifty-six' will be helpful in looking at html color codes