News & UpdatesProgrammingWeb programmingPartnersStore
Book Cover
Buy Now
Projects
Links

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

If you like this tutorial please +1 it:


One Response

January 20th, 2012 at 04:18  

Using HTML only you can change the text color like this:
<font color=”#FFFFFF”>white text</font>

However, the font element has been deprecated in favor of CSS. With CSS you can change the text color for example like this:
<span style=”color: #FFFFFF”>white text</span>

Leave a Reply