Adding Graphics Using the Image Element

The image element in XHTML is considered an inline element. This means that it can be contained within block elements such as paragraphs. It also means that the image will quite literally be rendered "in line," right where the tag is placed within the document. The minimal required syntax for the image element includes two attributes: src for the source URL of the image file, and alt for the alternative text used to describe the image:

<img src="myphoto.jpg" alt="A photo of the author" />

Practically, at least two additional attributes are needed: height and width. These attributes hold the vertical and horizontal measurements of the image, expressed in pixels. When present, these values allow the browser ...

Get XHTML by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.