HTML Encyclopaedia

Setting Colours

The color attribute of the <font> tag and the bgcolor attribute of the <body> tag are used to set the colour of text and the page background.

The value associated with the tag specifies a colour. There are two ways of specifying a colour

The hexadecimal number should be introduced with a # symbol and, ideally, enclosed in double quotes. The conventional names understood by some browsers originated with certain items of Microsoft software. The following table lists and exhibits all the conventional colour names defined in the HTML 3.2 standard. There are many other colour names in common use with reasonably well defined meanings but they are not included in the HTML 3.2 standard. There are, inevitably, restrictions on the maximum number of different colours a browser can display, these arise, primarily, from the manner in which colour display resources on the browser host interact with the colour display capabilities of the host system.

HexadecimalNameExample
#000000black 
#C0C0C0silver 
#808080gray 
#FFFFFFwhite 
#800000maroon 
#FF0000red 
#800080purple 
#FF00FFfuchsia 
#008000green 
#00FF00lime 
#808000olive 
#FFFF00yellow 
#000080navy 
#0000FFblue 
#008080teal 
#00FFFFaqua 

If your browser understands colour names this text will be red


See also <font>, <body>, general notes on tables and the colour cube