O'Reilly logo

Dynamic HTML: The Definitive Reference by Danny Goodman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required