HyperTextMarkupLanguage

HTML basics - Part 2 - Inline images

| Home | HTML basics - Part 2 - Agenda | Next |

Basic tags

IMG - Inline images

Appearance: <IMG SRC=URL>
Attributes: SRC=URL, ALT=string, ALIGN=left|right|top|middle|bottom, HEIGHT=n, WIDTH=n, BORDER=n, HSPACE=n, VSPACE=n, USEMAP=URL, ISMAP

EXAMPLE



<IMG SRC="http://www.library.com/images/trees.gif">
   or
<IMG SRC="trees.gif">


If linking is one great advantage of the Web, graphics are the other. The IMG tag is used to insert images within a page.

SRC

The SRC attribute is similar to the HREF attribute in that it designates the name of the file that contains the image. The SRC attribute can be an fully qualified URL or a relative URL.

ALT

The ALT attribute specifies the text to be display when the image cannot be displayed.

ALIGN

ALIGN controls the alignment of the image with respect to the text. A value of LEFT or RIGHT will make the image line up on the left or right margin, and text will flow around it. To force text below such an aligned image, use BR with the CLEAR attribute. The values TOP, MIDDLE and BOTTOM specify where any text following the image should be put. If more than one line follows after the image, it will be put below the image.

VSPACE and HSPACE

Specifies a numeric value, indicating the number of pixels that should be left free around the image. VSPACE covers vertical spacing and HSPACE the horizontal spacing.

BORDER The BORDER attribute is used when the image is a link. It tells the browser should draw a border of the specified size around the image showing that it is a link.

WIDTH and HEIGHT

The WIDTH and HEIGHT attributes contain the image's dimensions allowing the browser to lay out the page in advance, as it now knows where the text below the image should be drawn.

ISMAP and USEMAP

ISMAP and USEMAP are used for imagemaps. The ISMAP attribute specifies a server side imagemap. USEMAP indicates a client side imagemap.


| Home | HTML basics - Part 2 - Agenda | Next |

T07D035