EPUB HTML contains classes for styles twice?

One thing to be aware of is that if your style is only meant to change the paragraph settings, or it’s “shape” such as indenting and spacing, then there is no need to use a Paragraph+Character type style. The latter is where the span is coming from (right or wrong, personally I would say it is not correct to use spans that way, but that is how the HTML exporter works and we haven’t tried to manually correct that yet).

So you can at least get rid of the span by converting your paragraph style by redefining it and changing the “Save all formatting” setting “Save paragraph style” instead. And if that’s good enough for what you need, then that should be all you need to do to fix the problem.

If you do need character formatting preserved to some degree, then I would solve this with a line of CSS, added to the CSS format option pane:

  1. Double-click the compile Format you are using, in the left sidebar of the main compile screen, to edit it.

  2. In the CSS pane, make sure the dropdown above the CSS area says either “Append Custom CSS Stylesheet” or “Use Custom CSS Stylesheet” (the former is better unless you want more control).

  3. Paste the following in the “Custom Stylesheet” column:

    span.test { margin: 0; }
    

That will override the .test formatting, specifically only when the class is assigned to spans, leaving the indent on the paragraph as you desire.

1 Like