Images are a important part of many web pages. To include an image on your
page, you need to specify where the image file is located, by using an
img
element, with syntax:
<img src="location of image file" alt="alt string">
Both the src
and alt
attributes are required to be
valid html. The src
attribute tells the browser where to find the
image, and the alt
attribute has an alt string as a value
and tells the browser what to put in place of the image if the browser has its
display images setting turned off.
The location of image file
needs to be replaced with the
path to the image, which as in the previous lesson can be either an
absolute or relative URL.
Here is an example:
Which, assuming the file, orangespiral.jpg
is contained in a
directory called images
in the same location as the current file,
will display the following image: