<img>

NN 2, 3, 4, 6MSIE2, 3, 4, 5, 5.5, 6HTML4.01WebTVOpera5

<img> (no end tag)

Places a graphic on the page.

Attributes

align=type

Deprecated. Specifies the alignment of an image using one of the following attributes:

 

Type

Resulting alignment

Absbottom

Navigator 3.0 + and Internet Explorer 4.0 + only. Aligns the bottom of the image with the bottom of the current line.

Absmiddle

Navigator 3.0 + and Internet Explorer 4.0 + only. Aligns the middle of the image with the middle of the current line.

Baseline

Navigator 3.0 + and Internet Explorer 4.0 + only. Aligns the bottom of the image with the baseline of the current line.

bottom

Aligns the bottom of the image with the text baseline. This is the default vertical alignment.

center

According to the W3C specification, this centers the image horizontally on the page; however, in practice, browsers treat it the same as align=middle.

left

Aligns the image on the left margin and allows subsequent text to wrap around it.

middle

Aligns the text baseline with the middle of the image.

right

Aligns the image on the right margin and allows subsequent text to wrap around it.

texttop

Navigator only. Aligns the top of the image with the ascenders of the text line. An ascender is the part of a lowercase letter (like "d") that rises above the main body of the letter.

top

Aligns the top of the image with the top of the tallest object on that line.

 

alt=text

Required. Provides a string of alternative text that appears when the image is not displayed. Internet Explorer 4.0+ and Netscape 6 on Windows display this text as a "tool tip" when the mouse rests on the image.

border=number

Specifies the width (in pixels) of the border that surrounds a linked image. It is standard practice to set border=0 to turn the border off.

height=number

Specifies the height of the image in pixels. It is not required, but is recommended to speed up the rendering of the web page.

hspace=number

Specifies (in number of pixels) the amount of space to leave clear to the left and right of the image.

ismap

Indicates that the graphic is used as the basis for a server-side imagemap (an image containing multiple hypertext links). See Chapter 11 for more information on server-side imagemaps.

longdesc=url

Specifies a link to a long description of the image or an imagemap’s contents. This may one day be used to make information about the image accessible to nonvisual browsers, but it is not currently supported.

lowsrc=url

Netscape Navigator (all versions) and Internet Explorer 4.0+ only. Specifies an image (usually of a smaller file size) that will download first, followed by the final image specified by the src attribute.

name=text

Assigns the image element a name so it can be referred to by a script or style sheet.

src=url

Required. Provides the location of the graphic file to be displayed.

usemap=url

Specifies the map containing coordinates and links for a client-side imagemap (an image containing multiple hypertext links). See Chapter 11 for more information on client-side imagemaps.

vspace=number

Specifies (in number of pixels) the amount of space to leave clear above and below the image.

width=number

Specifies the width of the image in pixels. It is not required, but is recommended to speed up the rendering of the web page.

Internet Explorer’s dynsrc attribute

Using a dynsrc attribute, Internet Explorer Versions 2.0 and later also use the <img> tag to place a video on the page. The following attributes are related to the dynsrc function and work only with Internet Explorer:

controls

Displays playback controls for the video.

dynsrc=url

Provides the location of the video file to be displayed on the page.

loop=number|infinite

Sets the number of times to play the video. It can be a number value or set to infinite.

start=fileopen|mouseover|fileopen, mouseover

Specifies when to play the video. By default, it begins playing as soon as it’s downloaded (fileopen). You can set it to start when the mouse pointer is over the movie area (mouseover). If you combine them (separated by a comma), the movie plays once when it’s downloaded, then again every time the user mouses over it.