HTML: The Markup Language

imgimage # T

The img element represents an image.

Permitted content #

empty (void element)

Permitted attributes #

Descriptions for attributes specific to this element #

src = URI
A URL referencing a non-interactive, optionally animated, image that is neither paged nor scripted.
alt = normal character data
The fallback content for the image.
height = non-negative integer
The height of the image, in CSS pixels.
width = non-negative integer
The width of the image, in CSS pixels.
usemap = hash-name reference
A hash-name reference to a map element with which to associate the image.
ismap = "ismap" or "" (empty string) or empty
Specifies that its img element provides access to a server-side image map.
border = zero OBSOLETE
Specifies that its img element represents a borderless image.
The border attribute on the img element is obsolete. Consider specifying “img { border: 0; }“ in CSS instead.

Additional constraints and admonitions #

Tag omission #

The img element is a void element. An img element must have a start tag but must not have an end tag.

Permitted parent elements #

any element that can contain phrasing elements

DOM interface #

 NamedConstructor=Image(in unsigned long width),
 NamedConstructor=Image(in unsigned long width, in unsigned long height)]
interface HTMLImageElement : HTMLElement {
           attribute DOMString alt;
           attribute DOMString src;
           attribute DOMString useMap;
           attribute boolean isMap;
           attribute unsigned long width;
           attribute unsigned long height;
  readonly attribute unsigned long naturalWidth;
  readonly attribute unsigned long naturalHeight;
  readonly attribute boolean complete;