O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

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

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

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