Basic Web Design Tutorial Part 6

Adding an image to the page

The IMG tag allows us to include an image. In this example the image is in a sub-directory called “images” under the directory the web page is in. This is an empty tag, meaning that it does not have separate start and end tags. The SRC gives the image filename, in this case in a subdirectory called “images”. The ALT tag gives a description of the image and will be displayed as an alternative if the image fails to load for some reason. It is also useful for giving information to google image search and for text-only or speech-based browsers.

<h1>Example 7</h1>
<img src=”images/fivepennychairs.png” alt=”Pretty picture” />

Example 7 (opens in a new browser window)

Note here that the image is contained in a subdirectory of the example (the subdirectory is called “images”). If you copy this code onto your computer it won’t display the image unless there is a subdirectory called “images” in the directory as the HTML file which contains an image called the same.

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Leave a Comment