Inserting Graphics

Inserting a graphic on a Web page is as simple as placing an <img /> tag where you want the graphic to appear, like this:

<img src="logo.gif" />

Note

Note that this is a one-sided tag, and therefore needs to be closed with a space and slash (/) at the end in XHTML.

As you learned in Chapter 5, when a file is stored in the same folder as the HTML document in which it is referenced, you can refer to the file name only, without any location information. If you want to store your graphics in a subfolder of the folder containing the text files (to organize your files more tidily), you must refer to the graphic with the subfolder name, like this:

<img src="images/logo.gif" />

To refer to a file that is up one level in the folder structure, ...

Get HTML and XHTML Step by Step 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.