Skip to main content
Participant
December 2, 2024
Question

Object styles to html in epub

  • December 2, 2024
  • 2 replies
  • 241 views

Hello,

I am an experienced front-end web developer trying to make reflowable epubs  from indesign (beeing a very inexperienced indesign user). I am trying to make an object style that contain several text paragraps. I want it to result in the following html-code:

<div class="blaRundeHjorner">

  <p>some text…</p>

  <p>some more text…</p>

</div>

I made an object style, put two text paragraphs inside it and updated the Edit all export tags like this:

The problem is that neither the html div tag nor its corresponding css from the object style is in the html-file in the epub. The paragrapt styles is however there. How can I get the object style as an html-tag in the epub html?

This topic has been closed for replies.

2 replies

James Gifford—NitroPress
Legend
December 2, 2024

I'm not sure I have a 100% handle on your intent and goals, but consider this —

 

Object styles in ID have to apply to, well, duh, an object. They don't usually apply to text except indirectly. So if what you want is a group of paragraphs, or a box/frame containing paragraphs, that is subject to an ID Object style, that's how you have to set is up. Create the text frame, put your paragraphs in it, style them as desired, then apply a named (and saved/updated) Object style to the text frame.

 

You can use the Object style to format and 'shape' the text frame, and have elements of it apply to the text. That's in ID. For export, you'll now get a div.ObjectName style that contains what elements ID can and will export to EPUB (which is not all settings, and not always in a linear fashion — like lots of ID to EPUB elements). Since you're familiar with CSS, you can now use that style definition to touch up and re/style the text frame (now a <div>) and its contents.

 

But you have to apply that named style to the text or graphic frame, and sometimes to an element such as an image — it won't work as expected if you just try to apply it to the text. And, big warning here, text frames in InDesign have to be anchored in the main text flow or they will fall to the end of the exported document. (Most novices discover this first with TOC frames). You can't just "stick elements on the page," where they will work for print or PDF, for e-book export.

 

Does that point you in the right direction?

Inspiring
December 2, 2024

This method should work. Be careful in the EPUB export not to check "Ignore object export settings." Could that be the culprit?