View Single Post
Old 04-05-2011, 01:07 PM   #6
SamL
I mess around with Epubs
SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.SamL once ate a cherry pie in a record 7 seconds.
 
Posts: 82
Karma: 1566
Join Date: Mar 2011
Location: Cambridge, MA
Device: mac, ipad, nook, kindle
Quote:
Originally Posted by Jellby View Post
If you define the style for div.center-image, it's pointless to use <span class="center-image">, or to add a "center-image" class to anything other than a <div>. Moreover, a <span> does not use a text-align property. And you can't have block-level elements (like <div>) inside a <p>.

Try this:

Code:
<div align="center-image">
<img src="images/Stern_title_fmt.jpeg" alt="Stern_title.jpg" />
</div>
(And don't use arbitrary text for the "alt" attribute. It is intended to be used when the image cannot be displayed, for example when a text-to-speech system is being used. If the image is purely decorative, you can have alt="", otherwise use at least something descriptive of what appears in the image.)
I was using the <div align="center"> before, but when I go to validate the epub, I get the error:

ERROR: Stern Folder.epub/OEBPS/Stern.xhtml(14): attribute "align" not allowed here; expected attribute "class", "dir", "id", "style", "title" or "xml:lang"

So thats why I am trying to find another way to center the image.

Thanks for the help so far everyone!
SamL is offline   Reply With Quote