HTML/XHTML:Colours and CSS

From virtualMV2015wiki
Jump to: navigation, search

A brief introduction to how colours are represented

Colours are described to a web browser in a Red-Green-Blue (RGB) combination. Each colour setting is normally numbered in a system called hexadecimal (though there are other ways) with the values between 00 (off) and FF (full on). There are 256 possible numbers.

16 colour palette
  • The diagram illustrates the 16 standard colours with their names, RGB decimal values and the hexadecimal RGB value. *These colours can be used with the expectation that they will appear (be rendered) the same on all browsers and platforms.
  • The colour settings represent zero (00) half (80 or decimal 128) and full (FF or decimal 255) values, except for silver.
  • These colours are derived from the original IBM PC (1980) and its colour graphics array (CGA) video card and the original 16 colour windows colour set.
  • Also each colour is displayed on a white and black background to show contrast.
  • Note gray and grey are both ok.

Adding colours to some of the tags

If we want to change the colour (color?) of text between two tags we can use the color style for example:

<h3 style="color: #FF0000">This heading 3 is in red</h3>
<h4 style="color: #00FF00">This heading 4 is in green</h4>
<p style="color: #0000FF">This paragraph is in blue</p>

Which would display as

This heading 3 is in red

This heading 4 is in green

This paragraph is in blue

Changing the background colour of a web page

You can change the background colour of a we page by using the background-color style and attaching it as a container value in the body tag. The following example makes the web page light blue (aqua):

<body style="background-color: #00FFFF;">

Icon References.png References

HTML/XHTML:Colours and CSS. (2017). In virtualMV's ( Michael Verhaart ) wiki. Retrieved December 12, 2017, from    (zotero)