|
The background-color property sets the background colour of a tag. To set a colour, you specify a named colour, a hexadecimal RGB value or an RGB colour value: body {background-color: white;} h1 {background-color: #6633FF;} h2 {background-color: rgb(0,0,255);} The named colours are:
There aren't very many of them but the colours work on all machines. You can also use:
If you supply percentages or integers, you must enter the keyword rgb and put parentheses around the three values that you separate with commas. You can put colour behind a paragraph, a phrase, a word or even a letter if you like:
Internet Explorer 4 and 5 put a coloured rectangle around the whole paragraph. Netscape does something different, it puts the background colour around the just the text itself. You can also make the background colour transparent to make the underlying colours shine through. For details about all the colours you can pick from, see Colour list. |
More information Background colours and pictures background-color |