Share via


IMG XHTML Element

Send Feedback

The IMG element embeds an image in the document.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties for All DOM Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events and methods.

Attributes

Attribute Value PPC SP Description
ALIGN   Yes Yes Specifies the alignment of text following the IMG reference relative to the graphic on screen.
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
  absbottom Yes Yes This attribute is equivalent to the CSS:
vertical-align: text-bottom;
  absmiddle Yes Yes This attribute is equivalent to the CSS:
vertical-align: middle;
  baseline Yes Yes This attribute is equivalent to the CSS:
vertical-align: baseline;
  bottom Yes Yes This attribute is equivalent to the CSS:
vertical-align: bottom;
  left Yes Yes This attribute is equivalent to the CSS:
vertical-align: left;
  middle Yes Yes This attribute is equivalent to the CSS:
vertical-align: middle;
  right Yes Yes This attribute is equivalent to the CSS:
vertical-align: right;
  texttop Yes Yes This attribute is equivalent to the CSS:
vertical-align: text-top;
  top Yes Yes This attribute is equivalent to the CSS:
vertical-align: top;
ALT String Yes Yes Specifies a text alternative to the graphic
BORDER 0...# Yes Yes This controls the thickness of the border around the image (in pixels) whether as a hyperlink or as a stand-alone image.

This attribute is equivalent to the CSS:

border: {n} solid;
Note   Supported only for devices running PocketPC 2002 and Smartphone 2002 software or later.
CLASS   Yes Yes Associates the element with a CSS style.
Note   Supported only for devices running Windows Mobile 2003 software or later.
HEIGHT 0...# Yes Yes Specifies the height of the image in pixels or as a percentage of the parent object.

This attribute is equivalent to the CSS:

height: {n};
HSPACE 0...# Yes Yes Sets the horizontal margin for the image in pixels.

This attribute is equivalent to the CSS:

margin-left: {n}; margin-right: {n};
ID   Yes Yes Uniquely identifies the element within a document.
Note   Supported only for devices running Windows Mobile 2003 software or later.
ISMAP   Yes Yes Specifies that the image is a server side image map
NAME   Yes Yes  
ONLOAD   Yes Yes  
SRC URL Yes Yes Specifies the URL of the image to be displayed. The browser supports .JPEG, .JPG, .GIF, .PNG, .XBM, and .2BP files.
STYLE   Yes Yes Provides the definition of the CSS styles used for this element.
Note   Supported only for devices running Windows Mobile 2003 software or later.
USEMAP URL Yes Yes Specifies the URL of the client-side image map. For example, a bookmark like #map.
VSPACE 0...# Yes Yes Sets the vertical margin for the image in pixels.

This attribute is equivalent to the CSS:

margin-top: {n}; margin-bottom: {n};
WIDTH 0...# Yes Yes Specifies the width of the image in pixels or as a percentage of the parent object.

This attribute is equivalent to the CSS:

width: {n};

Scripting Properties

Property Type Access
alt string Read Only
border variant Read Only
height long Read/Write
hspace long Read Only
onload function Read/Write
src string Read/Write
vspace long Read Only
width long Read/Write

Scripting Events

This element has no associated events.

Scripting Methods

This property has no associated methods.

Requirements

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 5.01 and later

See Also

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.