a tag
map tag
style tag
TAG: img
<img>
Available in versions: 2.0, 3.2, 4.0
Browser compatibility: Explorer 4, 5 Netscape 4, 6
The
<img>
tag is used to insert a graphic or photographic image directly into the flow of text and other images. No line breaks or carriage returns are automatically inserted before or after the image. You can use attributes and style sheets to effect an appearance and presentation of images and text that suits your needs.
This tag can be placed in an
a
element to provide a clickable image for a hyperlink. A border will be automatically drawn around all four sides of an image used as a link. You can remove the border using style sheets or the
border
attribute.
The exact display of an image is very browser dependent.
There is no closing tag.
Core Attributes
class
dir
id
lang
onclick
ondblclick
onkeydown
onkeypress
onkeyup
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
style
title
Attributes
align
deprecated 4.0
The
align
attribute is used to control the position of the image with respect to the text and other elements. The permitted values are
absbottom, absmiddle, baseline, bottom, left, middle, right, texttop,
and
top
. This attribute is deprecated effective with version 4.0. However, most browsers continue to recognize this attribute.
alt
The
alt
attribute provides a text message that will be displayed (in place of the image) on browsers that cannot display a graphic image or picture.
border
The
border
attribute places a border around all four sides of the image. The thickness of the border is set in pixels. If you are using an image as a hyperlink and desire no border, set this attribute to zero.
height
The
height
attribute is used to set the vertical extent of the image in pixels.
hspace
The
hspace
attribute is used to add additional blank space in pixels to each side of the image.
ismap
The
ismap
attribute is a Boolean value that, when present, signifies that the image is being used as a mouse-clickable server-side image map.
longdesc
The
longdesc
attribute is the URL of a source that contains a long description of the image. This is useful for server-side image maps and nonvisual browsers.
name
The
name
attribute sets the name of the image. (This is required when using JavaScript.)
src
The mandatory
src
attribute is the URL of the location of the image file. The URL must include the file name and can include a relative or absolute path.
usemap
This
usemap
attribute specifies the name of an image map that you wish to associate with the element. This indicates that the image is being used as a mouse-clickable client-side image map.
vspace
The
vspace
attribute is used to add additional blank space in pixels both above and below the image.
width
The
width
attribute is used to set the horizontal extent of the image in pixels.
Code:
<img src="images/guru.gif" align="middle" alt="The Guru" border="2">
Output:
The Guru
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information