HTML Tag <IMG>
HTML Tag <IMG>
<IMG> Places an inline image in a document. You can use the attributes ISMAP= and USEMAP= with the <IMG> tag to implement image maps.
Attribute of <IMG> Tag
- ALIGN
- ALT
- BORDER
- CLASS
- CONTROLS
- DATAFLD
- DATASRC
- DYNSRC
- HEIGHT
- HSPACE
- ID
- ISMAP
- LOOP
- LOWSRC
- NAME
- SRC
- START
- STYLE
- TITLE
- USEMAP
- VRML
- VSPACE
- WIDTH
ALIGN
Specifies the appearance of text that is near an inline graphic image.
<IMG SRC="logo.gif" ALIGN=LEFT>
It's is a tutorial website that contain the content abut Computer science.
Possible Values
LEFT, RIGHT, TOP, MIDDLE, BOTTOM
ALT
Provides a textual description of images, which is useful for visitors who have text-only browsers. Some browsers may also display the ALT= text as a floating message when the visitor places the mouse pointer over the image.
<IMG SRC="logo.gif" alt="company name">
Possible Values
Any text message.
BORDER
Specifies the width (in pixels) of a border around an image. The default value is usually 0 (no border). The border color is the color of normal text within your document.
<IMG SRC="logo.gif" BORDER=2>
Possible Values
Any integer number.
CLASS
Indicates which style class applies to the <IMG> element.
<IMG CLASS="dkm" SRC="logo.gif">
Possible Values
Any Class Name.
CONTROLS
If the image is a video file, indicates the playback controls that appear below the image.
<IMG DYNSRC="my.avi" CONTROLS>
Possible Values
CONTROLS
DATAFLD
Indicates a column in previously identified tabular data.
<IMG SRC="logo.if" DATAFLD="color">
Possible Values
Field Name.
DATASRC
Specifies the location of tabular data to be bound.
<IMG SRC="logo.gif" DATASRC="#data_table">
Possible Values
URL
DYNSRC
Specifies the relative or absolute location of a dynamic image (VRML, video file, and so on).
<IMG DYNSRC="my.avi">
Possible Values
URL
HEIGHT
Specifies the vertical dimension of the image (in pixels).
<IMG SRC="images/logo.jpg" WIDTH=50
HEIGHT=50>
Possible Values
Value in Pixel.
HSPACE
Establishes a margin of white space (in pixels) to the left and right of a graphic image.
<IMG SRC="image/logo.jpg" HSPACE=20
VSPACE=15>
Possible Values
Value in Pixel.
ID
Assigns a unique ID selector to an instance of the <IMG> tag. When you then assign a style to that ID selector, it affects only that one instance of the <IMG> tag.
<IMG SRC="logo.jpg" ID="dkm">
Possible Values
Any ID Name.
ISMAP
Indicates that the graphic image functions as a clickable image map. The ISMAP= attribute instructs the browser to send the pixel coordinates to the server image map CGI application when a visitor selects the image with the mouse pointer.
<A HREF="/cgi-bin/image map/mymap">
<IMG ISMAP SRC="images/main.gif"></A>
Possible Values
ISMAP
LOOP
Indicates the number of times a video file plays back.
<IMG DYNSRC="bar.avi" LOOP=INFINITE>
Possible Values
n, INFINITE
LOWSRC
Indicates the absolute or relative location of a lower resolution version of an image.
<IMG SRC="bigpic.jpg" LOWSRC="lilpic.jpg">
Possible Values
URL
NAME
Specifies a name by which bookmarks, scripts, and applets can reference the image.
<IMG SRC="logo.jpg" NAME="cstutorial">
Possible Values
Any Name.
SRC
Specifies the relative or absolute location of a file that contains the graphic image you want to embed in a document.
<IMG SRC="images/logo.gif"
ALT="cstutorial">
Possible Values
URL
START
Specifies the event that triggers the playback of a dynamic image.
<IMG DYNSRC="dkm.vrm" START=MOUSOVER>
Possible Values
FILEOPEN, MOUSEOVER
STYLE
Specifies Style Sheet commands that apply to the inline image.
<IMG SRC="BACK.gif" STYLE="background: red">
Possible Values
CSS Property with values.
TITLE
Specifies text assigned to the tag. You might use this attribute for context-sensitive help within the document. Browsers may use this to show tool tips over the image.
<IMG SRC="images/loo.jpg"
TITLE="cstutorial">
Possible Values
Any Text Message.
USEMAP
Specifies the location of the client-side image map data (see the <MAP> tag). Because the <MAP> tag gives the map data an anchor name, be sure to include the name with the URL of the document that contains the map data.
<IMG ISMAP SRC="map1.gif"
USEMAP="maps.html#map1">
Possible Values
URL
VRML
Specifies the absolute or relative location of a VRML world to embed in a document.
<IMG VRML="vr/myroom.vrml">
Possible Values
URL
VSPACE
Establishes a margin of white space (in pixels) above and below a graphic image. (See the HSPACE= attribute for how to control the left and right margins of an image.)
<IMG SRC="images/logo.jpg" HSPACE=20
VSPACE=15>
Possible Values
Value in Pixel.
WIDTH
Specifies the horizontal dimension of the image (in pixels).
<IMG SRC="images/logo.jpg" WIDTH=50
HEIGHT=50>
Possible Values
Value in Pixel.