Help Center

Local Navigation

HTML element: <img>

Availability

Partial support as of BlackBerry® Device Software version 3.7.

Full support as of BlackBerry Device Software version 4.6.

The <img> element defines an image to display.

Differences between HTML, XHTML, and XHTML-MP

In HTML, the <img> element is not closed. To conform to XHTML (strict) or XHTML-MP, you must properly close the <img> element.

The following attributes have been deprecated in HTML 4.01. XHTML (strict) and XHTML-MP do not support these attributes.

  • align
  • border
  • hspace
  • vspace

Attributes

Attribute

Value(s)

Description

Availability

align

bottom

left

middle

right

top

Deprecated. This attribute specifies the vertical or horizontal alignment of the image on the page.

When the page is displayed in Column view, images are aligned horizontally. The BlackBerry® Browser only accepts the following values:

  • align=“left”
  • align=“right”

Vertical alignment is ignored.

3.7 or later

alt

text

Required. This attribute specifies the text that appears when an image is unavailable or cannot be displayed.

3.7 or later

border

pixels

Deprecated. This attribute specifies the width of a border around an image.

4.6 or later

height

length

This attribute specifies the height of the image, in pixels.

3.7 or later

hspace

pixels

Deprecated. This attribute specifies the amount of whitespace padding added to the left and right of the image.

4.6 or later

longdesc

URI

This attribute specifies the location of a document that provides a long description of the image.

4.6 or later

src

URI

Required. This attribute specifies the URI of the source image.

3.7 or later

usemap

URI

This attribute specifies the image as a client-side image map.

3.7 or later

vspace

pixels

This attribute specifies the amount of whitespace padding added to the top and bottom of the image.

4.6 or later

width

length

This attribute specifies the width of the image, with the unit of measurement.

3.7 or later

Common attributes

The <img> element supports the following common attributes:

  • class
  • dir
  • id
  • lang
  • style
  • title

4.6 or later

Event attributes

The <img> element supports the following events:

  • onclick
  • onkeydown
  • onkeypress
  • onkeyup
  • onmousedown
  • onmousemove
  • onmouseout
  • onmouseover
  • onmouseup

4.6 or later

Index


Was this information helpful? Send us your comments.