Images

Level: 1


NOTE:
You can use <img> for Level 0 if you include the alt attribute.

To incorporate in-line graphics into an HTML document, you use the img tag. With <img> you can insert another document in-line. The document is normally an icon or small graphic, etc. This element is NOT intended for embedding other HTML text.

Browsers which are not able to display in-line images ignore the img element unless it contains the alt attribute. Note that some browsers will be able to display (or print) linked graphics but not in-line graphics. If the graphic is essential, you may want to create a link to it rather than to put it in-line. If the graphic is essentially decorative, then img is appropriate.

The img element is empty: it has no closing tag. It has these attributes:

align

Take values top or middle or bottom, defining whether the tops or middles of bottoms of the graphics and text should be aligned vertically.

alt

Optional alternative text as an alternative to the graphics for display in text-only environments. This attribute is mandatory for Level 0 documents.

ismap

An image map is a graphical map by which users can navigate transparently from one information resource to another. The ismap attribute identifies an image as an image map. For example:

<a href="http://machine/htbin/imagemap/sample">

<img src="sample.gif" ismap>
</a>

For information on creating an image map, see Marc Andreessen's Graphical Information Map Tutorial at http://wintermute.ncsa.uiuc.edu:8080/map-tutorial/image-maps.html

src

The value of the src attribute is the URL of the document to be embedded. Its syntax is the same as that of the href attribute of the a tag. src is mandatory.


NOTE:
img elements are allowed within anchors.

An example of using <img> to insert an in-line graphic is:

<img src ="triangle.gif" alt="Warning:">

Be sure to read these instructions.

Preceding Section: Horizontal Rule
Following Section: Line Break
Parent Section: Body
Contents of HyperText Markup Language