Creating web pages VI


Subject: Creating web pages VI
From: Jim Buchanan <c22jrb@dawg.delcoelect.com>
Reply-To: <delco_explorers@hybiss.delcoelect.com>
X-List-Processor: perlproc 0.9, By J.R. Buchanan
X-Comment: Delco Computer Explorers mailing list
Sender: delco_explorers@hybiss.delcoelect.com

Today we do in-line images. First you'll need an image in .gif or .jpg format. There are *many* ways to draw or download such images, so I'll leave that to you. If anyone has any questions about creating images, just ask the list, you'll likely get a lot of answers.

To insert an image into a web page, use the "img" tag. This one is a little more complicated than the ones we've seen so far, in that it requires information about the image to be included in the tag.

Here is an example:

<img src="home.gif" ALT="HOME">

This tag inserts the picture named "home.gif" in the document. It also defines an alternate text that reads "HOME". The alternate text is displayed by some browsers when the cursor is moved over the image. It is also used instead of the image when people are browsing with images turned off, or with a browser that does not support images. Lynx is a popular non-graphic browser.

Here is a simple example of a web page with a header, and two horizontal lines with a picture between them:

<html>

<head>
<title>Yet another demonstration web page</title>
</head>

<body>

<h1>Pictures of Home</h1>

<hr>

<img src="home.gif" ALT="HOME">

<hr>

</body>

</html>

When you try this, you might not get any picture on the first try.

There are two likely reasons, your browser can't find the file which contains the image data, or, it might have found it, but it can't understand the format.

If you use the correct file name in the "img" tag, and make sure that the file is located in the same directory that the HTML file is, there should be no problem.

As far as image file formats, you'd be best off sticking with .gif and .jpg files, they are fairly well compressed, and most browsers can understand them. Note that it's not enough to simply name the file with a ".gif" or a ".jpg" on the end, the file must actually be created in that format.

Next time, I think I'll cover hypertext links. That will likely be next week, since the weekend is coming up. I've been writing most of this stuff up after work and sending it in the next day, and I probably won't find the time over the weekend.

-- 
Jim Buchanan        c22jrb@dawg.delcoelect.com         jbuchana@iquest.net
================= http://members.iquest.net/~jbuchana ====================
"For all the shut-down strangers and hot-rod angels, rumbling through this
 promised land, Tonight my baby and me we're gonna to ride down to the sea, 
 and wash these sins off our hands." -Bruce Springsteen
==================== http://hybiss.delcoelect.com ========================