News & UpdatesProgrammingWeb programming Store My Projects
Links
Affiliates

HTML Tutorial – 05 – Colors

Colors in HTML can be specified either by using a hexadecimal notation or by typing the name of the color.

Hexadecimal color notation

The hexadecimal notation uses a red-green-blue triplet, prefixed by a hash mark (#). Hexadecimal means base-16 counting, so valid digits are 0 through 9 and A through F. Each value can range from 00 to FF, or 255 in decimal notation. All in all this gives 16 million available colors.

<!-- white specified using hexadecimal notation -->
#FFFFFF

Named color notation

The named colors include only 16 names suggested by the HTML specification. However, all major browsers recognize over a hundred different color names.

<!-- white specified by name -->
"white"

Example colors

Below some example colors and color codes can be seen.

NameHexColor
Black#000000
Navy#000080
Blue#0000FF
Cyan#00FFFF
Lime#00FF00
Green#008000
Indigo#4B0082
Purple#800080
Violet#EE82EE
Gray#808080
Silver#C0C0C0
Gold#FFD700
Yellow#FFFF00
Orange#FFA500
Red#FF0000
Brown#A52A2A
Recommended additional reading:
Sams - Teach Yourself HTML and CSS in 24 Hours