Line


Adding Graphics & Graphic Links


Line



<IMG SRC>		    This is the tag for adding a graphic.


Example:
<IMG SRC="path/graphic_name.gif">

If the image or graphic is in the same folder or subdirectory as your web page, all you need to do is put the name of the graphic in the <IMG SRC> tag.



Example:
<IMG SRC="MyArt.gif">


If the image or graphic is in a folder or subdirectroy called Graphics, and the Graphics folder is inside the same folder or subdirectory as your web page, you will need to include the name of the folder before the name of the image.

Example:
<IMG SRC="Graphics/MyArt.gif">


If you want to control the size of the image you can add the attributes HEIGHT and WIDTH each followed by a number representing the number of pixels.

<IMG SRC="folder_name/graphic_name.gif" HEIGHT=# WIDTH= #>

Example:

<IMG SRC="Graphics/MyArt.gif" HEIGHT=100 WIDTH=150>



Another way to control the size of the image is to use percentages with the attributes HEIGHT and WIDTH. Place a percentage sign after each number which represents the percentage of the page size.

<IMG SRC="folder_name/graphic_name.gif" HEIGHT=#% WIDTH= #%>

Example for 50% of the page height and 90% of the page width:

<IMG SRC="Graphics/MyArt.gif" HEIGHT=50% WIDTH= 90%>



Some browsers do not show graphics. It is a good idea to accommodate users who are on those browsers by letting them know what was in that spot on your wed page. You can add another attribute that will tell them what they missed.

<IMG SRC="folder_name/graphic_name.gif" ALT=“Image Description”>

Example:

<IMG SRC="Graphics/MyArt.gif" ALT=“Image of a painting”>



You can use several attributes at the same time. So if you want to, you can use the ALT attribute and the HEIGHT and WIDTH attributes together.

<IMG SRC="folder_name/graphic_name.gif" HEIGHT=# WIDTH=# ALT=“Image Description”>

Example:

<IMG SRC="Graphics/MyArt.gif" HEIGHT=100 WIDTH=150 ALT=“Image of a painting.”>



You can use an image or graphic as a link. You just insert the <IMG SRC> tag inside the <A HREF> tag.

<A HREF="URL address (destination)"><IMG SRC="graphic_name.gif">Text</A>

Example:

<A HREF="http://www.yahoo.com"><IMG SRC="yahoo.gif"> </A>



When you use an image or graphic as a link you can still use the attributes.

<A HREF="URL address (destination)"><IMG SRC="graphic_name.gif" HEIGHT=# WIDTH=# ALT=“Image Description”>Text</A>

Example:

<A HREF=“http://www.yahoo.com”><IMG SRC="yahoo.gif” HEIGHT= 50 WIDTH= 55 ALT=“Yahoo Icon”> Yahoo! </A>




© Barbara Gibson, October 1996
Fourth Edition, January 1998



HTML Tutorial Table of Contents
Beginning your HTML Document/ Simple HTML Tags
Simple Anchors & Links/ The Hexadecimal System/ Wallpaper & Colors
Gathering Graphics for Your Web Page / Adding Graphics & Graphic Links / Tables / Forms
Frames/ Image Maps