The background of your page should be just that -- in the background. As we add different colors or even patterns, keep in mind that it should not interfere with the readability of text. For the pages of this tutorial, we have used a solid white color that makes for a clean and non-interfering (even if not dramatic) backdrop.
With some modifications to the <body> tag (introduced way back in lesson 1), you can add a solid color background to your web page. But before we show you how to do the fancy color stuff, we must first talk about RGB color values and their "hexadecimal" representation.
Here is the tricky part. Rather than identifying a color as something like "102,153,255" each number is converted from base 10 (normal everyday numbers, digits from 0,1,2,3,4,5,6,7,8,9) representation to hexadecimal, base 16 (digits from 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). Why? Hexadecimal is more easily and more efficiently understood by computers. So for the color example above, we would write in hexadecimal as "6699FF". In this example, "66" is the Red value, "99" the Green, and "FF" the Blue.
Here are some hexadecimal examples of different colors:
Color | Hex Code | Color | Hex Code | |
---|---|---|---|---|
xx oo xx | FFCCCC | xx oo xx | 3300FF | |
xx oo xx | 33FF66 | xx oo xx | AA0000 | |
xx oo xx | 663300 | xx oo xx | 9900FF | |
xx oo xx | 000077 | xx oo xx | FFFF00 | |
xx oo xx | EEEEEE | xx oo xx | 888888 | |
xx oo xx | 444444 | xx oo xx | 000000 | |
Now, don't panic about having do a bunch of numerical conversions! There are many tools that will let you click on a color and they will provide the hexadecimal representation. Many color tools are available from those folks at Yahoo.
But better yet, many browsers support standard shorthands for these 16 colors (those Windows VGA favorites):
|
||||
Color | Name | Color | Name | |
xx oo xx | aqua | xx oo xx | black | |
xx oo xx | blue | xx oo xx | fuchsia | |
xx oo xx | gray | xx oo xx | green | |
xx oo xx | lime | xx oo xx | maroon | |
xx oo xx | navy | xx oo xx | olive | |
xx oo xx | purple | xx oo xx | red | |
xx oo xx | silver | xx oo xx | teal | |
xx oo xx | white | xx oo xx | yellow |
NOTE: You may want to first try a test to see if your browser supports solid color backgrounds.For our Volcano Web, the first thing we will do is add a color background to the index.html file. The HTML format for adding a solid color background involves modifying the <body> tag to read:
<body bgcolor=#XXXXXX>where XXXXXX is the hexadecimal representation (indicated by the # sign in front of it) of the desired color.
If you recall, the image we use for the opening has pictures of volcanoes on a black background -- so if we were to use the same black color for the background of the web page, the picture would merge well into our page:
<body bgcolor=#000000>
<BODY BGCOLOR=#XXXXXX TEXT=#XXXXXX LINK=#XXXXXX VLINK=#XXXXXX>where the XXXXXX values will determine:
You can now add some of these other color values by changing the
tag to read:<BODY BGCOLOR=#000000 TEXT=#EEEEBB LINK=#44DDFF VLINK=#00FF88>This will provide a black background, pale yellow text, light aqua blue hypertext, and green hypertext to visited links.
NOTE: the order of the items in the <BODY> tag does not matterYou should now modify the <BODY> tags in all of your HTML files (fast and easy to do by copying and pasting the above example for the new <body> tag).
NOTE: You may want to first try a test to see if your browser supports textured backgrounds.Solid colors add some variety to web pages -- but you can go even farther by adding a textured background. You use a small image file (GIF or JPEG) and the browser will "tile" the web page with repeated copies of the image. Some of the things you should keep in mind are:
<body background="bgfile.gif">where bgfile.gif is the name of the image file (this can be a full URL or a relative file path -- see lesson 8a).
Below we list the names of three background files. You can download each one (if you do not know how to download graphics from a web page, please refer to our help sheet). You should put each graphic file in your pictures folder/directory in your web workspace:
<body background="../pictures/paper.gif" text=#AA0000>which gives us red text on yellow paper.
NOTE: Many web browsers have the ability to change the default text colors -- sometimes a user may have the preferences set for colors that will interfere with the ones you have selected. Therefore, we suggest when using any background tags (solid color or texture file) that you include the "normal" colors -- black for text, blue for hypertext links, and purple for recent links:If you are looking for some examples of background texture files, see Kai's Power Tips Background Archives<BODY TEXT=#000000 VLINK=#660099 LINK=#0000EE>
<body bgcolor=#FFFFFF>and
<body background="tiles.gif">?
The Internet Connection at MCLI is
Alan Levine --}
Comments to levine@maricopa.edu
URL: http://www.mcli.dist.maricopa.edu/tut/tut16.html