Prev

Images

Almost all web pages have pictures, or as they are called on the web, images. You can add an image to your web page using the <img /> tag. Like the anchor tag, the image tag requires an attribute called src, which is short for "source". The value of source should be a URL for the image you would like to display.

Try It: Use the <img /> tag to display an image on your page using an absolute URL, such as http://ict4me.sri.com/images/ict4me-logo.png
Just like anchor URLs, this URL can be absolute or relative. An absolute URL might be that of any image on the web, even though you did not create the image and it is not on the same site as your HTML file.

Tip: Check out Wikimedia Commons for images with copyrights allowing you to use them.
When using images from the web you should be careful to choose one with a copyright that allows you to use it. Most web sites do not permit you to use or copy images without permission.

You would use a relative URL if you wanted to use a file in the same directory as your web page called "flower.gif". The code you would add to your HTML page would be:

<img src="flower.gif" /> is displayed as:

Unlike the anchor tag, the <img /> tag is a stand-alone tag; it has no end tag.

Prev