WWW images are not placed directly on a page as they are in word processing or desktop publishing documents. Instead the path to the image is placed in the HTML document.
The <IMG> tag
The HTML tag for placing a graphic on a web page is:
<IMG SRC="image.gif">
For an image file one directory up from the current directory use,
<IMG SRC="../image.gif">
To place the flower line image on this page I typed:
<IMG SRC="flowbar.gif">
This image file is in the same directory as the HTML file that makes this web page.
Centering Images
To center the image place this tag around the <IMG> tag.
<DIV ALIGN=CENTER><IMG SRC="flowbar.gif"></DIV>
The ALT Attribute
To let your readers know what the image is going to be, use the ALT attribute in the <IMG> tag, Those who use the text only browser, Lynx, will not see your image but will see the description of the picture.
<IMG SRC="flowbar.gif"ALT="[a picture of a flower bar]">
Background Images
Web pages can have background images such as the white marble background on this page. BACKGROUND="whtmarb.jpg" is added to the body tag. <BODY BACKGROUND="whtmarb.jpg">
How do you get images?
You can create them yourself with a graphics program, scan a picture, take an image with a digital camera and save images from clip art web pages on the WWW. You can "take" the flower bar image on this page by clicking the right mouse button and choosing "save image as..." Save the image file in a directory that you choose.
Take a look at our HTML Resources page for links to many sites with clipart images.
Using WIDTH and HEIGHT
Netscape extensions for width and height in pixels in the <IMG> tag help your browser to load your page faster. It is a good idea to include these two in all image tags.
![]() You can find out the width and height by viewing "image information" in a graphics program. Netscape also gives the width and height on the top bar when the image alone is loaded on a page. |
Images as Links
Bonnie's image can also be a link to another page or perhaps a larger image. Watch the mouse arrow turn to a hand over the image. Click the mouse to activate the link.
Image and Text Alignment
ALIGN=TOP
![]() |
ALIGN=MIDDLE
![]() |
ALIGN=BOTTOM
![]() |
ALIGN=LEFT
![]() The Velveteen Rabbit Adding ALIGN=LEFT to the image tag puts the image on the left. |
ALIGN=RIGHT
![]() The Velveteen Rabbit Adding ALIGN=RIGHT to the image tag puts the image on the right. |
VSPACE and HSPACE
Adding VSPACE=30 and HSPACE=30 to the image tag puts white space around the image. VSPACE is vertical space and HSPACE is horizontal space in pixels.
![]() |