Name
<IMG> — NN all IE all HTML all
Synopsis
<IMG>
End Tag: Forbidden
The IMG
element displays a graphical image
in whatever MIME types the browser is equipped to handle. Common
image MIME types are GIF and JPEG. IMG
elements
are inline elements, appearing anywhere in the document you specify,
including in the middle of a line of text. A large number of
attributes affecting visual presentation of the element are
deprecated in HTML 4.0 in favor of style sheet rules. You will be
able to use the attributes safely for many browser generations to
come, however, because of the need to be backward compatible with the
large collection of image-laden documents already on the Web. Note,
too, that if you intend to use style sheets for
IMG
element borders and margins in Navigator 4,
you must wrap the IMG
element inside
DIV
or SPAN
elements and assign
the style sheets to the surrounding element. This workaround works
with Internet Explorer, too, so you can use style sheets in
cross-browser deployment.
If you want to make an entire image a clickable link, wrap the
IMG
element inside an A
element. To eliminate the typical link border around the image, set
the BORDER
attribute to 0
. And
for image maps (where different segments of an image link to
different destinations), the HTML recommendation encourages the use
of client-side image maps (via the USEMAP
attribute) over the server-side image map (ISMAP
).
To be backward compatible with earlier scriptable browsers, it is
advisable to include HEIGHT ...
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.