HTML and CSS Reference
Specify image dimensions
Finally, another way to improve performance is by including the im-
age's rectangular height and width information in its tag. By sup-
plying those dimensions, you eliminate the extra steps the exten-
ded browsers must take to download, examine, and calculate an
image's space in the document, allowing them to render the page
more quickly. There is a downside to this approach, however, that
5.2.5. JPEG, PNG, or GIF?
You may choose to use only one type of image format in your HTML doc-
uments if your sources for images or your software tool set prefer one
over the other format. All are nearly universally supported by today's
browsers, so there shouldn't be any user-viewing problems.
Nevertheless, we recommend that you acquire the facilities to create
and convert to at least the three formats we describe in this chapter to
take advantage of their unique capabilities. For instance, use GIF's an-
imation and PNG's transparency feature for icons and dingbats. Altern-
atively, use JPEG's deep compression, albeit at a loss of some integrity,
for large and colorful images for faster downloading.
5.2.6. The <img> Tag
The <img> tag lets you reference and insert a graphic image into the cur-
rent text flow of your document. There is no implied line or paragraph
break before or after the <img> tag, so images can be truly "in line" with
text and other content.