Make your own free website on Tripod.com

<IMG></IMG> - Inline Images

The <IMG> tag inserts an image into the HTML document. The src and alt attributes are required.

It is illegal to close this tag. </IMG> does not exist.

Attributes for <IMG>

  %coreattrs %il8n %events

R src=
  • "__"
    [URI to an image]
Gives the image's location.
This attribute tells the browser where to get the image from. It is a required attribute.

R alt=
Gives description.
This attribute provides a short description of the image for non-graphical browsers and browsers with automatic image loading turned off. It replaces the image with the alternate text, and formatting applied to the IMG element also applies to the alttext. It is a required attribute; however, if alt is not specified, the default value is usually "image".

  longdesc=
Gives location of description.
This attribute specifies the location of a long description of the image or image map. This attribute may supplement, but not replace, the alternate description provided by alt.

  height=
Gives height in pixels.
Gives height by percent of available space.
This attribute can override the inherent height of the image and either stretch or shrink it to fit the specified width.
This attribute can be also used to give the actual width of the image in pixels. When combined with the width attribute, it allows the browser to load the text before the images. I highly recommend you use this attribute.

  width=
Gives width in pixels.
Gives width by percent of available space.
This attribute can override the inherent width of the image and either stretch or shrink it to fit the specified width.
This attribute can be also used to give the actual width of the image in pixels. When combined with the height attribute, it allows the browser to load the text before the images. I highly recommend you use this attribute.
If you don't know the height and width of your image, Netscape can tell you: open up the image in the browser; [width] × [height] will be shown in the title bar. PLEASE use this attribute. Viewing graphical web pages without width and height attributes is very annoying.

D border=
Gives border thickness in pixels.
This attribute controls the thickness of the border around the image. The default value is "0", meaning no border. However, it is customary for browsers to automatically put a border around image links.

  usemap=
Identifies the image map coordinates using the name of a <MAP> element in a fragment identifier.
This attribute applies a client-side image map to the image.

  ismap
This boolean attribute indicates the use of a server-side image map. The image must appear within a hyperlink to the processing script for this to work.

D align=
  • "top"
Aligns top of image with top of text line.
  • "middle"
Aligns vertical center of image with vertical center of line.
  • "bottom"
Aligns bottom of image with baseline.
The attribute controls the vertical alignment of the image in relation to the text line.

D align=
  • "left"
Aligns image with left margin.
  • "right"
Aligns image with right margin.
This align attribute controls horizontal alignment (floats). By aligning the image with the left or right margin, it allows the text to wrap between the image and the opposite margin. The <BR> tag is used with the clear attribute to stop text wrap.

Examples of inline images:


Here is the code for the sample above:


Related Topics

See <BR> for examples with left/right aligned images.

HTML & Server Side Image Maps

To use a server side image map, the image must be placed within a link to a processing script. The browser will call the script by URI, attaching a question mark and the coordinates of the click. ("cgi-bin/script.cgi?x,y") If the browser cannot input coordinates (text browsers, for instant, can't), the coordinates returned will be 0,0. ("cgi-bin/script.cgi?0,0")