[Index]
[Up]
[Back]
[Next]
4.4 IMG (In-line Images) Element
The IMG element allows an image document to be
inserted within an HTML document. The purpose
is to allow pictures to be included within a
document and presented with the text, as opposed
to having hypertext links that retrieve and display
images in a separate viewing window.
This element can not be used to include
other HTML text within a given document.
Images can be included within a hypertext anchor:
thus you can make an image icon behave as a button to
access other documents. An example is given at
the bottom of this document.
The IMG element is empty, meaning there is no
closing </IMG>. It has three attributes:
- SRC="image_url"
- SRC give the URL of the image document. The
naming scheme is the same as for
hypertext links: thus relative URLs such as
SRC="foo.gif" or SRC="../foo.gif"
are commonly used. At present
you can only inline GIF images and X-bitmaps
(standard extensions are .gif, .xbm, .xpm). This attribute
must be present.
- ALIGN=BOTTOM (MIDDLE, or TOP)
- ALIGN tells the browser how to align the image
with the neighbouring text. BOTTOM aligns the bottom
of the image with the bottom of text, and is the default.
MIDDLE aligns the middle of the image with the middle of text,
and TOP aligns the top of the image with the top of text.
This attribute is optional.
- ALT="alternative text"
- Some browsers cannot display images: The optional
ALT attribute allows you to specify a text alternative
to the image, for use by text-only browsers. This attribute
is optional.
- ISMAP
- Many servers and browsers also support the ISMAP
attribute. This attribute marks the image as an active
image map. This allows the user to
click the mouse over the image and have different
regions of the image cause different actions. See
ISMAP to find out more
about how to do this.
Examples
Look at Section 4.4.1 to see some
examples of the use of the IMG element.
[Index]
[Up]
[Back]
[Next]