XML technologies / ePUB / ePub für (In)Designer / Images, boxes and other design elements / Wrapping text around images and boxes / Help! I forgot text wrapping and the object style!

(Excerpt from “ePub für (In)Designer — Mit InDesign Schritt für Schritt zum E-Book” by Sascha Heck & Yves Apel)

Have you already prepared the final ePub and made numerous changes to its HTML and CSS code, but forgotten wrapping and object styles for images? As in a famous novel, our advice is:

Don’t panic

Figure: Don’t panic.

You will probably see something like this:

Image wrapping and object styles forgotten

Figure: Starting situation with image wrapping and object styles forgotten.

Open the relevant HTML file in an editor and find the code beginning with <div class="group">.

<div class="group">
   <div class="image">
      <p class="para-style-override-2"><img width="109" height="204" src="images/125px-Katana-_Klinge_fmt.jpeg" alt="125px-Katana-_Klinge.jpg"/></p>
   </div>
   <div class="story">
      <p class="impressum para-style-override-3"><span>Querschnitt durch die Klinge eines Katana.</span></p>
   </div>
</div>

In the first line, replace the word “group” with a name of your choice, for example <div class="umfliessen">.

<div class="umfliessen">
   <div class="image">
      <p class="para-style-override-2"><img width="109" height="204" src="images/125px-Katana-_Klinge_fmt.jpeg" alt="125px-Katana-_Klinge.jpg"/></p>
   </div>
   <div class="story">
      <p class="impressum para-style-override-3"><span>Querschnitt durch die Klinge eines Katana.</span></p>
   </div>
</div>

Switch to the CSS file (template.CSS) and append these lines at the very end:

div.umfliessen {
  float: left;
  width: 150px;
  margin: 3px 12px 12px 0;
}

where the code float: left; or float: right; specifies image placement on the left or right. Your chosen name must follow “div”.

That is all: in each HTML file, change the line for each image to <div class="umfliessen">.

  

 

 

 

back to top