Next / Previous / Contents / TCC Help System / NM Tech homepage

10.9. img: Include an image

Use the img element to place photos, diagrams, or other artwork on your page. The image must be available at a location given by some URI.

Note

This element is deprecated in favor of the more generalized object element. See Section 13, “The object element: Embedded multimedia and applet objects”.

Here is the content model:

element img
{ attribute src { xsd:anyURI },
  attribute alt { text },
  attribute longdesc { xsd:anyURI }?,
  attribute height { text }?,
  attribute width { text }?,
  Common.attrib,
  empty
}
src

Use the URI of the image file as the value of the src attribute.

alt

You should always provide a textual description of the image so blind readers will know what they aren't seeing.

longdesc

To make available a more complete description of the image, place that description at some URI and use that URI as the value of the longdesc attribute.

height

If you don't provide a height attribute, the height of the image will be its natural size. You can override that height by specifying this attribute as a length; see Section 6.1, “The length datatype”.

width

As with the height attribute, you can override the image's natural width by providing a width attribute whose value is specified as described in Section 6.1, “The length datatype”.

Common.attrib

This element supports all the attributes from Section 15.3, “The common attributes: Common.attrib.

empty

No content is allowed inside an img element.

Here's an example:

  <img src="empgoo.gif" alt="Emperor Goose, Moss Landing, CA"/>