<img>
) and additional styling that is needed to make it line up where we want it.First, the
.ZIP
file “Bridge.zip” should be copied to your hard drive and unpacked. This new package has the same files as previous packages but also includes a decorative image named “o.jpg.”- In your text editor, open the file “content.html.” The image element is an empty element (has no end tag). It contains three necessary elements: The “img” element name, the url of the graphic, and alternate text (alt) that will be read by screen readers or displayed on mouse-over by devices that do not display images.
- Locate the first
<p>
tag in the document. We are going to replace the “O” in ONCE with a graphic, so delete the “O.” Immediately following the<p>
tag, insert the following line:<img src="o.jpg" alt="Once" />
- The first line of the html file should now read:
<p><img src="O.jpg" alt="Once" />NCE UPON A TIME,
That is all that needs to be done to theHTML
file, so save it and close it. Next we will work on the style sheet to indicate how we want the image to be displayed. Open “styles.css” in your text editor. - We will add two lines in the style sheet. One line will remove the indent from the first paragraph of text that follows a
<h1>
heading. The second will cause the image to “float” to the left of the paragraph. This means that it will line up with the top of the line of text and the text will wrap around it. At the end of the css file add the following two lines:h1 + p { text-indent:0; }
img { float:left; } - Save and close “styles.css.” Open “Bridge.opf” in your text editor. We need to add the graphic element to the manifest so that readers understand it is part of this eBook. Locate the “manifest” portion of the file and before the closing
</manifest>
tag add the following line:<item id="o" href="O.jpg" media-type="image/jpeg" />
- Save and close the file, then drag and drop the three changed files into the
OEBPS
folder in your.ZIP
file. Change the extension to.ePUB
and open your book in a reader.
You have now added a graphic element to your eBook. We will deal more extensively with images in a future chapter and discuss some of the kinds of files you can use for images, different ways of displaying them in your text, and how to organize them in your document. Next, we’ll add several new chapters to the eBook.