View Single Post
Old 04-15-2024, 09:26 PM   #5
Jaws
JCL Punch-Card Collector
Jaws began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Jun 2014
Location: Antarctica
Device: Aggressively Device Independent
I think some of the responses have misunderstood the original query, which was about removing the extra spaces.

The most-probable cause is in the stylesheets... but it could be in any of several places in the stylesheets, because the style could be called in several different places. It might be in the style for <body>, for the <div> element including the text, or individually in <p> (and you'll want to look at both the first paragraph in an html file and later ones — these often have different styles assigned).

What you're looking for is a combination of the misbegotten "display: block" element in the style, and the failure to explicitly specify the top and bottom margins as 0, which I've found most convenient to put at the end of the style:

{

margin-top: 0;
margin-bottom: 0;
}

(Note also the semicolon after the last element — although not required by CSS, just be in the habit. Think of it like having a period at the end of the sentence before a new paragraph.)

Two notes:

Although CSS allows use of the margin: 0 style to supposedly set all margins for that style to 0, this is not supported in many e-pub readers (despite epubcheck and other checkers allowing it to pass as "legal") and creates unpredictable results when converting to other formats. Not Recommended.

display: block should be used only when that paragraph is not reflowable (a stanza of poetry in which the linebreaks are &lt;/br&gt; is one example, so are some multililne descriptive headings); this should be pretty rare. It's also the default for unknown reasons in epubs generated by software from the baked-mud company.
Jaws is offline   Reply With Quote