Including a Simple Image
How do you include an image in your HTML file so that you can view it
in your WWW browser? If you simply want an image to appear on your web page, you can use the following syntax in your HTML document:
<IMG SRC="imagename.gif">
Specifying Dimensions
One of the most important attributes of the image tag is the ability to specify how large an image is in both width and height. Most image editing programs will let you do this, in addition to a lot of the conversion utilities such as Graphic Converter. The speed gain you get from specifying the dimensions of an image are because the browser can go ahead and reserve an exact location on the screen while the downloading of much faster text can be placed. When the image is finally downloaded, the text does not have to reload to flow around the images. Following is the correct syntax to specify the width and height:
<IMG SRC="imagename.gif" WIDTH="128" HEIGHT="96">
where "128" is how wide the image is in pixels and "96" is how high the image is in pixels.
Aligning Text
Something else that may help you out is the ability to line up text next to an image so that text lines up at the top, middle, or bottom. Depending upon which one you need, the following is the correct syntax:
<IMG SRC="imagename.gif" ALIGN=TOP>
<IMG SRC="imagename.gif" ALIGN=MIDDLE>
<IMG SRC="imagename.gif" ALIGN=BOTTOM>
Here are some examples of the previous HTML regarding aligning images:
This is aligned to the top of the image.
This is aligned to the middle of the image.
This is aligned to the bottom of the image.
Aligning Images and Text Flow
You may also want to align an image to the left or right of the page and have text flow around it instead of text aligning itself with part of the image as in the previous example. To accomplish this, we use another value of the ALIGN attribute, either LEFT or RIGHT, shown in the following example:
<IMG SRC="imagename.gif" ALIGN=LEFT>
Below is an example of how the ALIGN=LEFT tag aligns the image to the left and controls text flow around the image. The text should flow around the image much like you would see in a newspaper.
In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) atque aliquod iam sibi poscit opus. Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?)
<IMG SRC="imagename.gif" ALIGN=RIGHT>
This is an example of how the ALIGN=RIGHT tag aligns itself to the left and controls text flow. Notice the image is aligned right and again, the text should flow around the image much like you would see in a newspaper.

In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) atque aliquod iam sibi poscit opus. Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit. Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?)
Image Spacing
If you want a specified amount of space around an image so that text is not crowding the image, then you can use the attributes to allow space in the vertical direction (called VSPACE) and in the horizontal direction (called HSPACE). The proper syntax follows:
<IMG SRC="imagename.gif" VSPACE=5 HSPACE=10>
where "5" is the amount of space reserved in the vertical direction (top and bottom of the image) in pixels, and "10" is the amount of space reserved in the horizontal direction (left and right of the image) in pixels.
Following are some examples of VPACE and HSPACE in action. The first example has a VSPACE=O and HSPACE=0.
In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor?
an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) atque aliquod iam sibi poscit opus. Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
The next example has VSPACE=20 and an HSPACE=0. Notice how the attribute affects both sides of the image equally.
In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor?
an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) atque aliquod iam sibi poscit opus. Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit. Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
The next example has VSPACE=0 and an HSPACE=20. Notice how the attribute affects both sides of the image equally.
In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor?
an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) atque aliquod iam sibi poscit opus. Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
The last example has VSPACE=10 and an HSPACE=10, making the space around the image equal on all sides.
In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor?
an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) atque aliquod iam sibi poscit opus. Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Delius ipse venit. Iam mihi mens liquidi raptatur in ardua caeli, Perque vagas nubes copore liber eo. In se perpetuo Tempus as revolubile gyro Iam revocat Zephyros, vere tepente, novos. Induiturque brev Tellus reparata iuventam, Iamque soluta gelu dulce virescit humus. Fallor? an et nobis redeunt in carmina vires, Ingeniumque mihi munere veris adest, iterumque vigescit ab illo (Quis putet?) Castalis ante osculos, bifidumque cacumen oberrat. Et mihi Pyrenan somnia nocte ferunt. Concitaquq arcano fervent mihi pectora motu, Et furor, et sonitus me sacer intus agit.
Note that the VSPACE and HSPACE attributes work not only amongst text, but also amongst other images.
Typical Image Tag
Of course the IMG tag can take any number of these attributes at any time. The following example would be a typical IMG tag on a typical web page:
<IMG SRC="imagename.gif" WIDTH="130" HEIGHT="98" VSPACE=10 HSPACE=10 ALIGN=LEFT>
As you can see, you can string any number of attributes together with the image tag.
Graphic Links
Graphic links are just like text links in that they let you click on a graphic to link to a new file or URL. The syntax follows:
<A HREF="file-to-link-to.htm"> <IMG SRC="imagename.gif" ></A>
where imagename.gif is the graphic to click on, and file-link.htm is the file or URL to link to when the image is clicked.
When you create a graphic link, your browser will draw a colored box around the graphic (the same color as the hypertext links) to indicate it is a link. Some people like this effect and some people don't. If you prefer to not have the box surrounding your image, you need to add the BORDER=0 parameter to the IMG tag. It would look something like this:
<A HREF="file-to-link-to.htm"> <IMG SRC="imagename.gif" BORDER=0></A>
Other Information
Another valuable source of information can be found at Netscape where they expound on a few more attributes of the IMG tag.
Click here and you will find yourself at Netscape's HTML 2.0 assistance page, where you'll find more information regarding the IMG tag.
Also, check out the College of Forestry's comprehensive listing of HTML guides.