• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Trying to add space in EPUB document

New Here ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

Hi

I think what I'm trying to do is probably quite simple but I can't for the life of me figure it out. I need to add space above the text on an ebook title page, and also I need to add some space above each of the chapter headings.

For the title page, I've tried Object Export Options > Custom Layouts > Space Before but no matter what value I input it has no effect - the text still appears at the top of the page on the exported EPUB.

For the space at the start of each chapter, I've tried adding things in the paragraph style but it seems lots of information gets discarded on export to EPUB.

Hopefully someone has a solution!

TOPICS
EPUB

Views

2.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

Presumably this is for a Reflowable ePub, not a FXL ePub.

Carriage returns aren't recognised in HTML. Make a Paragraph Style , with space after/ bfore for every space requirement, you may need to produce a lot!.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

You're right, it's reflowable.

The only Paragraph Style that your suggestion works on is my HEADER style (which is the chapter title). This leads me to think that my problem might have something to do with where InDesign is splitting the EPUB. The other pages where this doesn't work don't seem to have splits before them. Does that make sense?

How might I fix this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Hey yall I will thank my teacher for this everyday, because there's this lovely thing called a "soft return".

 

It is used in place of a clasic return. (The button you use to create space between titles and paragraphs.)

 

The easiest way to accomplish this change is to turn on hidden characters.

You'll see all the 'P's along the sides.

Simply click where you see a 'p', highlight it to save you time, and hit Shift-Return.

It will make this line instead of the 'p'!

 

Truely simple! 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Truly awful advice. It's horrible for print and even worse in a reflowable epub.

Sorry, but that's just the way it is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Well how do you do it then? I use this for epub. So, it is a solution. There's also a way to do it using export tags as well. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

There's a difference between solutions that make something happen on the screen, and maybe when printed out, and ones that work in fully compliant way that will survive output to varying formats (PDF, EPUB, on through to Kindle, HTML, etc.) You can hack and slash a letter or a memo, but if you need to get to stable publication, you have to follow the rules.

 

Rule #1 (or close to it) is "Never use more than one whitespace character in a row." A paragraph end followed by a line break (soft return, etc.) is two in a row. No go, boyo. 🙂


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

The way EPUB readers handle space-above varies, for one thing. As with web browsers, there is not necessarily a one-size-fits-all solution for every downstream reader.

Three things that work under varying conditions to put "chapter head" space over a paragraph are:

  1. Page break before followed by space-above. Usually works.
  2. Paragraph rule above, of thickness and offset to give the desired spacing, with rule color set to white (can show on tinted/dark backgrounds) or None (can be ignored by the reader).
  3. Small paragraph style with page break before (and a non-breaking space or other placeholder character; an empty paragraph will be removed in the export), which will force the spacing above on the next paragraph to appear. Usually. Definitely a hack.

╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

I have never found a solution to this in adobe. indesign does a great job creating CSS but for whatever reason will never generate margin-top. 

I use sigil to examine the html and css made by indesign. 

Here is a title page in html. I want to do the same thing, I want a top margin above the title text:

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>012_epub_sonata_front_69_copy</title>
<link href="css/idGeneratedStyles_0.css" rel="stylesheet" type="text/css" />
<link href="css/idGeneratedStyles_2.css" rel="stylesheet" type="text/css" />
</head>
<body id="x012_epub_sonata_front_69_copy">
<div id="_idContainer002" class="_idGenObjectStyleOverride-1">
<p class="half-title ParaOverride-1">Sonata in Wax</p>
<p class="section-sub-head">a novel by </p>
<p class="section-sub-head"><span class="CharOverride-1">Edward Hamlin</span></p>
</div>
</body>
</html>

 

the page uses two style sheets generated by indesign. idGeneratedStyles_0.css and idGeneratedStyles_2.css

you can see the link href in the third and fourth lines for these style sheets.

style sheet 0 is global, fonts etc for the entire book.

style sheet 2 is specific to that page

 

this is the title of the book and the text I want to drop by 200 px:

<p class="half-title ParaOverride-1">Sonata in Wax</p>

there are two classes called here, p class and ParaOverride-1. in design classes don't use spaces so the space between means that the p or paragraph is multi-classed.

 

I ignore style sheet 0 since it is for the whole book and I know that overrides and specific things are in the second style sheet. In style sheet 2, I find this code:

 

p.ParaOverride-1 {
margin-bottom:59px;
}

 

which controls the text I want to change. a quick look at the whole sheet shows me that there is no margin-top commands, except to sometimes set the margin-top to zero. this is just peculiar to indesign, none of the settings will translate into margin top when rendering the epub, even if it is present in your paragraph styles.  It would be nice if they just added a check box or something (use margin-top?) but they don't. so the fix is just to write your own in the css that applies to your page openers

 

p.ParaOverride-1 {
margin-bottom:59px;
margin-top:200px;
}

 

here I just added a margin-top line that looks good.

 

make sure to review everything. if you make a book you should have CSS 0 and an additional style sheet for each file that makes up the book. 

 

https://sigil-ebook.com/

 

sigil is here. hey you might be mad and say I'm a print designer not a web designer, but everyone in pub design should open their epubs and take a look at the code. Sigil is super logical and a great platform for learning. You get a preview window that shows exactly what you are doing at every step. CSS is the preschool of coding and everything says what it does, like margin-top. best practice, supposedly is to have only one sheet of css which you can do by pasting them all together and rewriting the links but I never bother with this. the 4 or 5 sheets indesign uses don't increase the size very much. the other critical thing is the TOC which indesign is pretty good at generating. make sure to google it because the TOC.NCX file is important for epub. 

 

in my work I am not really any good at CSS but it is clear enough to do little things like add margin

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

update: my main chapter titles all appear in CSS sheet 0--- so I added margin top to my chapter title class and the whole book now has space at the top of each chapter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

All good information, but I'm of the strong and well-founded position that no one should ever edit an exported EPUB, any more than we edit print-export (PS) files or PDFs. It is entirely possible to get an EPUB into an optimal state through export plus CSS, and that's the modern way to do it — "mold it correctly in the first place, don't carve on it later." Or use the "lego" methods of a decade past to assemble an EPUB from component parts created separately.

 

(FWIW, you've found and resurrected a three year old topic, and many things have moved on since then.)

 

It is not difficult to get top spacing into EPUB or Kindle. There are two or three methods that are entirely within the scope of InDesign settings and CSS. The biggest problem is that readers are erratic about preserving top spacing even when it's included — and I think at least part of your approach here is overlooking that ID does indeed include the top spacing, but whatever reader you're using is being "helpful" and suppressing it.

 

The two keys for basic page-top spacing are to split the EPUB at export before any heading that needs top spacing (e.g. chapter and section heads), and to add CSS <padding-top> along with the exported <margin-top> statement. Even then, some readers will need additional steps to enforce top-spacing, and there's still the problem of intermediate heads showing page-top spacing when the real preference is for that spacing to be collapsed.

 

All it all, it has more to do with readers implementing their own notions of virtual pagination (since reflowable EPUB has no pages, or has just one), and it usually means several approaches have to be combined to give the most users the best experience.


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

wait

1) you should never open an exported epub

2) everything can be done with indesign and CSS

how do you edit CSS without opening it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

Emerald has posted inaccurate information IMO. For Mac users BBEdit is an excellent tool for opening, changing and Saving. Reflowable ePubs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

no one should ever edit an exported EPUB...

doesn't BBEdit open it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

Two things you should note: this is not a general EPUB forum; it's for InDesign users and discussion of how ID creates EPUB is only one valid topic among many. (That said, I don't know of a good EPUB/publishing forum, so this will have to do — but again, it's about ID to EPUB, not EPUB creation in general.)

 

You also seem to be overlooking that the ID export process allows you to include one or more CSS files. It's trivial to keep editing and refining such a file as a document develops or as you apply 'polishing' to ID's output. Following strict rules about how the ID doc is created, especially in consistent use of styles (and style naming, for CSS-matching purposes!) is essential. But ID embeds the CSS on export, no surgery or changes to the export file needed.


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

this is accurate.... I wrote good code for the top margin and ibooks is ignoring it. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

I'll just repeat what I said: the entire workflow of either building an EPUB from component files, or editing an exported EPUB file, is obsolete. That some good part of the author/small publishing world clings to these practices is neither here nor there, especially when "here" is the InDesign forum.

 

It is both possible and preferable to create EPUBs, using InDesign, by following some structural and formatting guidelines in the ID docs, mastering the EPUB export process (including things like individual export settings for images), and using a CSS style file — which can and does produce EPUB files ready either for distribution or for submission to KDP for Kindle. There is no need any more — at least 99.9% of the time — to edit any part of an EPUB file's content . (If an EPUB file is faulty, fix the process, not the result.) That whole practice is like... using wite-out to fix faults in printed pages, instead of correcting the file and printing it out again, without flaws.

 

The entire top-spacing thing is fuzzy and frustrating because of the variation in the way the readers handle it. The best practice is to use several overlapping techniques, which generally combine to give the right result even across different reader.

 

Apple's reader is good, but nonstandard in some key ways. Unless you're developing to sell only through iTunes, it should not be used as a primary development and proofing reader. In general, Calibre is the best 'development' reader, although it's not perfect, either.

 

You might find this a useful introduction to these modern processes, using ID — http://www.nitrosyncretic.com/DPR/dpr_indesign_epub_basics.php. There are several companion essays there on related and advanced topics as well.


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

I don't get this.... is there some way to look at or edit the CSS before you export?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

Yes. The slow and clumsy way is to look at the Export tab for each style, where the fundamental CSS ID that will export for those settings is listed out. That's tedious, though. If you want the complete CSS for an export, you have to extract it from an exported EPUB, and then use that as your model and starting point for writing your modified styles. Those styles are fed back in the import process via the EPUB Export menu.

 

Extracting the ID-generated CSS is typically a one-time process, unless the project and styles evolve considerably.


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

oh I was excited I thought I could just type a padding-top in here..... it doesn't let you edit this field though.

you are still going to have to open it to change the style sheet, whether it is with sigil, bbedit or something else....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

No, you only have to open it — which can be with any ZIP archiver as well as any specialized tool — to extract a first copy of ID's CSS. You never have to open or modify an export file after that. The changes are all upstream, between ID export settings (and some style management), and the revised CSS file you feed into the export. No EPUB editing required at all.

 

InDesign's one quirk in EPUB export is that it will not export padding statements, at all, even when they are appropriate. I don't know why. It's just one thing to remember when fine-tuning the output, especially when doing "dual format" projects that can export direction to PDF/print and EPUB.


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

ok..... after all I wrote about HTML, I found that yes as James noted almost every ereader eliminates margin top. 

I changed my code to use padding instead of margin and now it works fine in ibooks and elsewhere. so if you read my long post talking about css and sigil the code needed is padding-top not margin-top. 

images show the code and result in ibooks. I really can't account for how to go about working with the CSS in indesign though since there is no way to see the stylesheets

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

I want a concise answer since this stumped me.

the answer is to edit your CSS sheet however you do it and add 

padding-top: 100px (or any value)

to any style you would like to have top margin

here is the result on kindle and apple ibooks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

Well, that's a concise answer, but not necessarily the answer. As I said, top spacing is dependent on a number of factors and it takes two or three of them to make sure you get top spacing where you want it, but not where you don't want it. That's even though any one reader might need only one of those settings. Those same files may not work the way you want on another EPUB reader, and adding top spacing to things like lower-level heads (for sections, etc.) can mean you end up with that spacing at page-tops even though that's not very esthetically pleasing. Even Kindle has changed the rules a few times just in the last couple of years; I have updated books that originally behaved fine only to find out the spacing is no longer accurately honored.

 

There's no absolute answer, not over time and across readers, since readers all have their own quirks in how they paginate documents, and those rules sometimes change with version updates. Just one of the fun parts of the e-book publishing ride. 🙂


╟ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

you can easily control it using this code which is auto-generated by InDesign

 

padding-top:50px;
page-break-after:auto;
page-break-before:always;

 

if you use keep in paragraph styles set to "start on a new page" InDesign will write page "break-before: always"

in the style. this is a style that always starts on its own page. 

In Design won't write margin or padding and ereaders ignore margin, but they do display padding. 

if you add "padding-top:100px;" to a style that has "page-break-before:always;"

that style will always start on a new page, 100px from the top on any ereader.

If you have one set style for your chapter heads and page break before it is easy and effective

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines