|
Have a good dinner? Fido fertilize your neighbor's lawn? Then I guess we're ready to start with the next lesson.
Last time we found out how to get images onto our page, but there's one image we didn't talk about. That's the one used as a background for everything else. It sets the mood of your site. Well, we're going to catch that now by examing the <BODY> tag [which we learned about in the second lesson] a little more closely.
If you'll remember, the <BODY> tag is one of those necessary tags without which we don't have a web page. I also told you that the bulk of the HTML document is inserted between the <BODY> and the </BODY> tags. This pair of tags actually defines what will be displayed in the browser window.
There are a couple items that go within the <BODY> tag itself, attributes if you like. They define the defaults for the page and set up the background if you choose to use one. Now, none of these attributes are required to be entered. If you leave them out, they simply revert to whatever the visitor's browser has set in it. As a matter of fact, the visitor's browser can over ride any settings you make -- you can't do anything about that. Most of your visitors won't have set up their web browsers that way though.
The attributes we'll be looking at for the <BODY> tag are:
We'll use color #99FF99, which is a pale green, to set our mood. Here's how the HTML code looks:
Inserting that in our Oscar page, the HTML document now looks like this:
<HEAD>
<title> My Pet Turtle, Oscar </title>
</HEAD>
<BODY BGCOLOR="99FF99">
<CENTER><H1>Oscar, the Painted Turtle</H1></CENTER>
<FONT SIZE=+3 COLOR="BLUE">T</FONT>here seems to be a strange attraction between boys and odd animals of all sorts. Certainly some of us can remember the time<P><IMG SRC="turtle.jpg" HEIGHT=150 WIDTH=200 ALIGN="left" BORDER=5> when every dime-store in the United States sold those little turtles, there small, round aquariums [usually with a plastic <FONT COLOR="LIME">palm tree</FONT> stuck in the center], and the <FONT COLOR="#FF3333">dried insects</FONT> to feed them with.
<P> Times change and we don't see an awful lot of those turtles any more for one reason or another. However, some countries other than the U.S. still offer these amazing animals as pets, which is how I came about acquiring Oscar.
<P> Oscar was purchased at a local pet shop here in Korea for the tidy sum of 4,000 won [ that's about 3 dollars, U.S. money ]. He was just a little tyke about the size of a quarter when I bought him and brought him home. I've alway's enjoyed strange and unusual pets and you don't get much stranger than a turtle.
<P> Oscar is a true turtle, as opposed to a tortoise, and spends all of his time in the water. His home consists of a 55 gallon aqarium -- completely filled with water, several rocks to hide under, and some plastic plants. These latter are more for my benefit than his, since he can't eat them [ though he tries ] and I doubt that he appreciates their asethic value.
<P> I've had Oscar for about three years now and am amazed at how he's grown. At the present time he is larger than a grown man's hand -- and still growing. Oscar will eat just about anything, but his favorite food seems to be small green frogs that abound around my neighborhood. Fish are also welcomed, and I can no longer keep tropical fish as pets along with him as I used to. Sooner or later he'll eat them.
<P> Turtles are interesting in several respects -- one being the length of time they can remain completely under water. And so forth and so on ......
</BODY>
</HTML>
The resulting page turns out like so:
Fig 9

Notice in Fig 9 above the text color I used earlier for 'palm tree' just about disappears in this new background color. If I were actually going to post this page, I would change the color of that text. But since this is a tutorial and I'm going to be changing the background several more times, I'm not going to bother.
You can use either gifs or jpgs for a background -- which is basically nothing more than an image which is displayed throughout the page -- in back of everthing else.
You don't specify the size [using something like HEIGHT and WIDTH as we did for the <IMG> tag] in your HTML document. The visitor's browser will use the entire image at it's normal size for a background. If the image is not large enough to fill the browser window, it will 'tile' [more on this in a minute]. If the image is larger than the browser's window, the browser will cut off the image, starting on the right edge and working inward.
On browser windows/monitors. There is a range of sizes for monitors nowadays. Still the most common is the 14 inch monitor. This generally gives a 640x480 display area (be warned though -- the user can change this). Quickly catching up is the 17 inch monitor with it's 800x600 display. Now available, but not in wide use are even larger monitors -- 20 or 21 inches and bigger probably using a 1280x1024 display. Remember, all these sizes are measured in pixels. The higher the resolution [ie 800x600 is higher than 640x480] then the more displays on the visitor's browser on each line.
Why am I telling you all this? What use is it? Well, it can be useful for planning if you're going to use a background image and you don't want it to tile. You'll have to use an image that fills the largest possible browser window size and accept that surfers with smaller screen sizes will not see all the image. This latter shouldn't be a big consideration though, since we're not really concerned that they see or don't see the whole image. It's a background after all, just meant to set a mood. If the image is important, then you should use it as a regular image within the page.
Can you somehow control the surfer's browser window size? Yes and no. For our purposes right now -- no. As you continue learning web design, you'll find you can ensure that a new browser window is opened and set to 480x640, the size of the smallest common computer monitor thereby controlling how the visitor sees your site. But this is done through JavaScript, which is well beyond the scope of this tutorial.
Let's highlight what makes a good image for a background then we'll look at some examples.
First an abstract image, small in physical size so that it will 'tile' when displayed. Now, I've used that term quite a few times. What's it mean. Actually, it means nothing more than a picture that repeats itself over and over, row upon row, filling in the background. You've seen 'em. There is no special command to make a background image tile or not -- it simply depends upon the physical size of the graphic and the size of the viewer's browser window. If the viewer's browser window is larger than the image, it will tile.
Our first example is a relatively small jpg file [about 6K] which will tile when displayed. However because of the image, it will look like one large solid image. Here's the actual size of the picture we're going to use. I'm calling the file 'bkgd1.jpg'

Here's how we enter the image into the <BODY> tag for display as a background image:
And how it appears on Oscar's page:
Fig 9a

Let's look at another small background image -- a non-uniform, abstract one so that the tiling effect can clearly be seen. Here's the image I'm going to use, appropriately named 'bkgd2.jpg'.

And here's Oscar:
Fig 9b

By the way, notice the 'crinkeling' effect around the text on Fig 9b. Remember in an earlier lesson I explained that jpgs were not good at reproducing sharp edges? This is what happens. However, I used a jpg here because of file size. A comparible gif file would have been over 200K and taken forever to download. [the jpg here is about 31K]
We can also use a regular photo as a tiled background. For our next example I'll use Oscar's picture. Note: I can't resize this in the HTML document like I did before, so to get a small image I'm going to have to resize it in my Paint program. Additionally, I'll lighten the new image so that it doesn't take away [too much] from the page content itself. Here's the reformated image:

And how the web page looks with the new background.
Fig 9c

Fig 9d

You've probably seen home pages that have a border down one side. Maybe you've wondered how they do that [maybe not]. Anyway, the trick is real simple. We'll use just a plain gray background with a light brown border on the left side. All you're really seeing is a repeating image -- a very short, very wide one.
Here's the image I've made for the background:
It's physical size is 10 pixels high by 600 pixels wide and is a little less than 1K in file size. I could have made it only 1 pixel high, but then you'd have a difficult time seeing it clearly as an image here. As a background, with the image repeating, the result would be much the same, though. Here's the resulting page:
Fig 9e

Something else which bears mentioning. The first background image we made and this last will not appear to 'scroll' with the page as the viewers reads. This is because of their uniformity. All the others will 'scoll' [that is move] when your visitor moves down your page. MS Explorer has a <BODY> attribute which will freeze the background image in place [the content of your page scrolls past a fixed background]. To the best of my knowledge NetScape Navigator has not yet incorporated this attribute into its browsers. If you wish to make your background image non-scrolling [works for MS Explorer browsers only!!] then add the BGPROPERTIES attribute:
So much for backgrounds. I believe you have a good solid start. The key, as with anything, is to play around with it, manipulate it and see what works for you. Let's discuss the TEXT, LINK, VLINK and ALINK attributes of the <BODY> tag now.
Let me define each of these in a few choice words, then I'll cover how to do the TEXT attribute. The other three are done in the exact same manner.
The TEXT attribute defines the base color to be used for all text on your page. That's it. Nothing fancy.
The LINK attribute defines the color to be used for the text used in all of the hyper-links on your page. This sets your email link text color as well.
The VLINK attribute defines the color to be used for the text used in all of the hyper-links which your page's visitor has clicked on and gone to. Information on which links have been visited is kept in each individual surfer's own computer -- it will not affect your page other than how he views it [ie. this is information unique to each visitor].
The ALINK attribute defines the color to be used for the text used in the link which your visitor is actively clicking on at the moment. In other words, it's the color it changes to while he's pressing the left mouse button with the cursor over a hyper-link.
The color of each of these attributes is set in the same manner as we set the BGCOLOR at the beginning of the lesson. Generally you want to use the hex-coded numbers, but you can use the named color values as well.
Here's the example for setting the TEXT attribute:
This will give us a base text color of 'sand'. Remember, you can always change this throughout your document by using the <FONT> tags.
To wrap up this lesson, let's look at a completed <BODY> tag with all attributes [we've discussed] added in. We'll use a TEXT color of 'sand', LINK color of 'white', VLINK color of 'blue', an ALINK color of 'red' and a solid colored background [BGCOLOR] of 'black' as the example.
<BODY BGCOLOR="000000" TEXT="FFFFC8" LINK="FFFFFF" VLINK="0000FF" ALINK="FF0000">
We're moving right along. Let's do our lesson review:

