今天是阳历 2024 年 05 月 06 日 星期一 农历 三月月 廿八日

 

[<<Back 返回]   [Online Resource Centre 教学材料]   [E-Teacher 电子教师]
 

Basic HTML

Background Colors

We've now learned a variety of ways to find resources on the Web. Let's use some of these Web resources to help us modify your homepage into something that looks a bit snazzier.

The "Body" HTML Tag

If you open your homepage file with the editor you will find near the top an HTML "body tag" that has the following form

<BODY BGCOLOR="#ffffe0" TEXT="#ff0000" 
LINK="#00ffff" VLINK="#00ffff" ALINK="#FF0000">

Such tags control the colors for the text when a Web Browser displays your page, according to the identifications in the following diagram (note that in HTML the tags are generally not case sensitive; e.g., "BODY" and "body" are equivalent).

The labels in the diagram are rather self-explanatory in light of earlier discussion except, perhaps, for the "accessed link" color. This is the color that the link turns while the mouse button is being held down. Thus, for example, the statement text="#ff0000" sets the standard text color to red. Now obviously there is some kind of secret code involved here: how do I know that #ff0000 means to set the browser text color to red?

Hex Numbers and Color

Well, # indicates that this is a color and the next six characters (ff0000) are in the form xxyyzz, where xx is the amount of red, yy is the amount of green, and zz is the amount of blue mixed to form the text color, with each of these pairs (e.g., ff) a number in the base-16 or hexadecimal number system---the "hex system", to those in the know.

Whew! I'm sure you are looking forward to learning about that! If humans had 16 fingers and 16 toes instead of 10 each we probably would know the base-16 system by heart, but it is unlikely that many of you use hexadecimal numbers on a regular basis. Is there a way to bypass studying the base-16 number system, at least for now? After all, we just want to change some colors on our homepage!

You should learn something about the base-16 system because it is so common in computers and because it is fun, but we will save that for later. For now we are going to illustrate that we can learn how to change colors on our homepages without learning how to do base-16 numbers in our head. We shall do so by using resources that are available on the Web. That is, we are going to set our newly-won "Finding Things" expertise to a useful and noble task: the avoidance of work in the process of accomplishing something useful!

Color Resources on the Web

Your assignment is to modify the colors on your default homepage to something more to your liking. What would greatly simplify that is to have a table of colors with the associated hex code for the color. Then we could find some colors that we liked from the table and just copy the corresponding hex code into the body tag in our homepage. Even better, in the best of worlds we might hope for a computer program that would allow us to click on a continuous dispay of colors to select them, and once they were selected, to display a sample page with those colors to see how they actually look in a browser display.

Such resources are out there on the Net. We can use search engines to find them. Pick one of the search engines, type in words or a phrase such as "hex code" and see if you can find a hex table of colors.

The results page should have many links. Find a hex table there that will help you select colors for your homepage. Select some new colors to customize your homepage by changing the colors in the "body" tag.

 
[<<Back 返回]   [Online Resource Centre 教学材料]   [E-Teacher 电子教师]
      School Name 学校名称
      Online Resource Information 线上资源资讯
      News & Events 学校新闻
      Events Calendar 每日事件