As you've probably noticed, you can add pictures to your web site. Most web browsers
can support only the following graphic types:
GIF (graphic interchange format)
XBM (X Windows)
XPM (X-Pixelmap)
JPEG (joint photographic experts group)
Like most other funtions in the HTML language, the option to put a picture has a tag.
Like the list's tag, there are additional attributes that can be added to the basic tag
for more options.
The basic tag for a picture is:
<img src="Image's source">
Place the image's source or URL+the filename and extension instead of "Image's
source." Your picture should appear.
Other attributes you can add to your picture tag are:
- Alt=
- Displays the text written after the equal sign in the event that the picture cannot be
shown (in the case of non-graphical browsers such as Lynx)
- Align=
- Can be used to align your picture in relation to the text. The options are center, top,
bottom, left and right.
- Height= Width=
- This option diminishes the time it takes to load your page as the browser doesn't have
to wait until it gets the coordinates of your picture before continuing to load the page.
You need to put the exact size of your picture (in pixels), or it will come out distorted.
- Border=
- Draws a border around your picture in the width you wrote
- Usemap=
- Declares your picture is a clickable image map, which is discussed in the intermediate
section
Here is an example of a picture tag using all the options except usemap:
<IMG Src="http://www.geocities.com/colosseum/stadium/8622/lion.gif"
ALT="a lion" height="110" width="150" border="2"
align="center">
You should get this picture:
You can also associate a picture with a link, so that a click on the picture will
transfer you to another URL, as if you were pressing an ordinary link. To do so, write the
tags of an ordinary link (<A href=Url>...</A>). Instead of replacing the ...
with text as you would with a normal link, replace it with the picture tag, like this:
<A href="Url"><Img src="Image's source"></A>