HTML colors are defined using a hexadecimal (hex) notation for the combination of Red, Green, and Blue color values (RGB).
HTML Codes format
Each HTML code contains symbol "#" and 6 letters or numbers. These numbers are in hexadecimal numeral system. For example "FF" in hexadecimal represents number 255 in Decimal.
For example, in the the color red, the color code is FF0000, which is '255' red, '0' green, and '0' blue.
Meaning of symbols
The first two symbols in HTML color code represents the intensity of red color. 00 is the least and FF is the most intense. The third and fourth represents intensity of green and fifth and sixth represents the intensity of blue. So with combining the intensity of red, green and blue we can mix almost any color that we like.
How to use HTML color codes?
With HTML color codes you can set the color of web site background, color of text, cells in tables and much more.
Using HTML color codes for web site background color:
<body style="background:#FFFFCC">
Using HTML color codes for setting font/text color:
<span style="color:#6633FF>
Using HTML color codes for table background color:
<table style="background:#CCFFFF">
Using HTML color code for link color:
<a style="color:#990099>
Web Safe Color Palette
Earlier computer used to support 256 colors only. The 216 cross-browser color palette was created to ensure that all computers would display the colors correctly when running a 256 color palette.
List of safe colors in shown along with its code:

Color Names Supported by All Browsers
You can use the color name instead of color code

Note: The names above are not a part of the W3C web standard.
The W3C HTML and CSS standards have listed only 16 valid color names: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.
If you want valid HTML or CSS use the HEX values instead.
You can surf the net to have more information about color in HTML.
Hope this article would have helped you in understanding color names and their respective code. Need not to worry about color codes and their names, as you will practice, you will master them.