img element 

Specifies information about an image included within a content page, including its content identifier, rendering preferences, and an alternative string that describes the image.

Element Information

Element type: xsd:complexType


Schema name: Simple Content Format

Elements and Attributes

Parent Elements

Child Elements







Possible values




The content identifier of the associated binary image data.

Any positive integer.


Alignment (simple type)


Specifies the horizontal alignment of the image on the page, although devices need not conform to the setting of this property. If not specified, the default is "l" for left alignment.

  • "l" (left)
  • "r" (right)
  • "c" (center)


ImageFit (simple type)


Specifies how the image is rendered relative to the screen on the device.

  • "native"
  • "width"
  • "screen"
  • "auto"

For more information about these possible values, see Remarks.




Specifies alternative text to be displayed in place of the image, when necessary.

Any valid string.


The content identifier, specified by using the id attribute, refers to the content identifier that provides access to the binary image data.

The img element uses the Alignment simpleType element to specify the valid values for its align attribute. The valid values are "l", "r", and "c", designating alignment to the left, to the right, and to the center, respectively.

The img element uses the ImageFit simpleType element to specify the valid values for its fit attribute. The valid values are "native", "width", "screen", and "auto", with the following meanings:

  • native: Use the native resolution of the associated image, cropping the width as necessary (horizontal scrolling is not supported).
  • width: Proportionately scale the associated image to fit the available width of the screen.
  • screen: Proportionately scale the associated image to fit the width and height of the screen without requiring scroll bars.
  • auto: Let the device determine the best size for the associated image, thereby enabling the device to fit all content (text and images) on a single screen by adjusting the size of the associated image.

Usage Example

The following code example references an image from a page in a media player gadget.

    <content id="200" title="Now Playing" bg="50" bgfit="s" menuid="1000">
        <txt align="c" wrap="0"><em>Song Title</em></txt>
        <txt align="c" wrap="0">Song Artist</txt>
        <txt align="c" wrap="0">00:00:00</txt>
        <img align="c" id="16" alt="[Album Cover]" />

Schema Definition

The following scheme defines two simple types and an element.

<xsd:element name="img">
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required" />
        <xsd:attribute name="align" type="Alignment" use="optional" />
        <xsd:attribute name="fit" type="ImageFit" use="optional" />
        <xsd:attribute name="alt" type="xsd:string" use="optional" />

<xsd:simpleType name="Alignment">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="l|r|c" />

<xsd:simpleType name="ImageFit">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="native|width|screen|auto" />