Layout Considerations When Using the <img /> Element

After you have an image stored and ready to be posted on the Web, you must use the XHTML <img /> element to place the image on a page. <img /> is a standalone element that takes the attributes shown in Table 5.1. According to the XHTML 1.0 standard, only the src and alt attributes are mandatory. You will quickly find, however, that you want to use many of the attributes.

Table 5.1. Attributes of the <img /> Element
AttributePurpose
altSupplies a text-based alternative for the image
alignControls alignment of text following the image
borderSpecifies the size of the border to place around the image
heightSpecifies the height of the image in pixels
hspaceControls the amount of whitespace to the left ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 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.