Partager via


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

Namespace: https://schemas.microsoft.com/sideshow/2006/scf

Schema name: Simple Content Format

Elements and Attributes

Parent Elements

content element

Child Elements

None.

Attributes

Attribute

Type

Required

Description

Possible values

id

xsd:positiveInteger

Required

The content identifier of the associated binary image data.

Any positive integer.

align

Alignment (simple type)

Optional

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)

fit

ImageFit (simple type)

Optional

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.

alt

xsd:string

Optional

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

Any valid string.

Remarks

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.

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

Schema Definition

The following scheme defines two simple types and an element.

<xsd:element name="img">
    <xsd:complexType>
        <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:complexType>
</xsd:element>

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

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

See Also

Concepts

ISideShowContent
content element