With some slight modifications to the <body> tag , a solid color background can be added to your web page. (No more of that deary, drab gray.)
In a web browser, there are 256 system colors for coloring text and backgrounds. Each color is identified by its Red- Green- Blue (RGB) values, by three numbers that range from 0 to 255, each of which represents the intensity of the Red, Green, or Blue of the desired color. The maximum values of all three (R=255, G=255, B=255) produce the color white and the minimal values (R=0, G=0, B=0) produce black. All other colors are represented by varying RGB triplets.
It gets tricky here. Here is where our math folk might shine. Rather than identifying a color as something like "102,153,255" each number is converted from (normal everyday numbers, digits from 0,1,2,3,4,5,6,7,8,9) base 10 representation to hexadecimal, base 16 (digits from 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). You of course ask, "Why?" Well, the hexadecimal system 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are also 16 colors which are recognized by browsers by names. This keeps you from having to use the Hex codes. The following are the colors that browswers recognize by name:
For these Web page lesson pages, the color that we chose was white. Prior to adding the background color tag to the HTML for the pages, the background of the pages was the default, gray. 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.
NOTE:When you use the hexdecimal color code, don't forget that your HTML coding must have the # symbol in front of the six numbers and or letters.
On Your Own
<body bgcolor=#FFFFFF>
If you did things correctly, your browser should have changed the background to a solid white. There are alsosome other options to add to the body tag to color the text in your Web page and to change the color of any of the the hypertext items:
where the XXXXXX values will determine:
You can add some of the other color values by changing the tag to read:
<BODY BGCOLOR=#FFFFFF TEXT=#FFFFCC LINK=#33CCFF VLINK=#CC3333>
NOTE: The order of the items in the <BODY> tag does not make any difference, but when you include color values within the body tag, this affects your entire Web page document.
Font Color
Now, change the <BODY> tags in all of the HTML files that you have created. This can be fast and easy to do if you copy and paste the above example and replace the old body tag in your documents with the new <body> tag. Then, change the solid color backgrounds of your web pages to different colors by varying the hex coding. Also, change the color and size of some of your text, to see how this effects the look of your Web page. If you would like to try out background texture files, check out this list of links from Yahoo.
NOTE: Many browsers have the ability to change the default text and background colors. Sometimes a user may have their preferences set for their own choice of colors. The following are the default or "standard" ones that most people use on their Web pages.
BODY TEXT=#000000 VLINK=#660099 LINK=#0000FF