Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-25-2012, 06:45 PM   #1
Alda
Connoisseur
Alda began at the beginning.
 
Posts: 74
Karma: 22
Join Date: Jun 2010
Device: none
Problems removing white space between paragraphs

Hi,

I'm trying to remove the white space between paragraphs in my eBook. The Sigil FAQ tells me:

Quote:
To remove the white space between the paragraphs, add this to the bottom of the CSS code (the yellow color text in the Code View):

p {margin: 0; padding: 0;}
I tried adding this in various places in each file (including what looks like yellow coloured text to me), but to no avail. I then figured out that I probably needed a CSS style sheet, and after figuring out how to create that, I placed the code in there. I also linked the style sheet to the file and added this code to the top of the file itself:

Quote:
<link href="../Styles/myfirstbook.css" rel="stylesheet" type="text/css" />
... making sure I had the name of my particular stylesheet in there, instead of myfirstbook.css.

Still nothing.

Can anyone tell me what I'm doing wrong? I'm a bit of a novice at this, although I have used Sigil before to create an eBook ... but at that time I just left the white space as it was.

Grateful for any help. Thanks!
Alda is offline   Reply With Quote
Old 06-25-2012, 06:58 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 8,313
Karma: 36123946
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
Would need to see a sample of the actual html code to see what may be going on for sure. That particular CSS won't get rid of all whitespace if there's something like: "<p>&nbsp;</p>" or "<p><br /></p>" throughout the code.
DiapDealer is offline   Reply With Quote
 
Enthusiast
Old 06-25-2012, 06:59 PM   #3
Alda
Connoisseur
Alda began at the beginning.
 
Posts: 74
Karma: 22
Join Date: Jun 2010
Device: none
Aha. I expect that's the problem, then. Here's an example of a sentence:

Quote:
p>O<small>NE EVENING, MANY YEARS</small> ago, I was travelling through south Iceland with two of my cousins. We stopped in the town of Vík to camp for the night. After pitching our tent at the campsite we decided to take a walk before turning in. It was in the middle of summer, so it was broad daylight even though it was late in the evening.&nbsp;<br /></p>
So is that what's messing it up? Any solutions to fix this?

Thanks!
Alda is offline   Reply With Quote
Old 06-25-2012, 07:03 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 8,313
Karma: 36123946
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
Quote:
Originally Posted by Alda View Post
Aha. I expect that's the problem, then. Here's an example of a sentence:



So is that what's messing it up? Any solutions to fix this?

Thanks!
Yes... and yes. Get rid of the &nbsp;<br /> so that it looks like:
Code:
p>O<small>NE EVENING, MANY YEARS</small> ago, I was travelling through south Iceland with two of my cousins. We stopped in the town of Vík to camp for the night. After pitching our tent at the campsite we decided to take a walk before turning in. It was in the middle of summer, so it was broad daylight even though it was late in the evening.</p>
DiapDealer is offline   Reply With Quote
Old 06-25-2012, 07:10 PM   #5
Alda
Connoisseur
Alda began at the beginning.
 
Posts: 74
Karma: 22
Join Date: Jun 2010
Device: none
Yes, but it's on every paragraph in the book, and there are hundreds, maybe even over a thousand.

Is there a way to avoid getting them in there in the first place, e.g. if I save as html or something? (This was pasted from Word.)
Alda is offline   Reply With Quote
Old 06-25-2012, 07:20 PM   #6
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 13,605
Karma: 5126946
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Alda View Post
Yes, but it's on every paragraph in the book, and there are hundreds, maybe even over a thousand.

Is there a way to avoid getting them in there in the first place, e.g. if I save as html or something? (This was pasted from Word.)
That is what Search and Replace is for.

Search (NORMAL mode, All HTML): &nbsp;<br /></p>
Replace: </p>

I guess that to be safe you should check for scene breaks BEFORE you do this search&replace

COUNT (Normal, all HTML): <p>&nbsp;<br /></p> If it comes up Not found, this combo nation was not used.
Note substitute <p class="<what you see>"> if your P tags have a common class
theducks is online now   Reply With Quote
Old 06-25-2012, 07:26 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 8,313
Karma: 36123946
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
Quote:
Originally Posted by theducks View Post
I guess that to be safe you should check for scene breaks BEFORE you do this search&replace
That would be my only concern, too. But even then... I'd probably be willing to sacrifice the scene-breaks (or any other vertical spacing breaks) at that point just to get things cleaned up. I could always add them back in with CSS if I have an original document to compare to.
DiapDealer is offline   Reply With Quote
Old 06-26-2012, 12:31 AM   #8
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,317
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
moved

Last edited by roger64; 06-26-2012 at 06:04 AM.
roger64 is offline   Reply With Quote
Old 06-26-2012, 03:21 AM   #9
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 639
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
Quote:
Originally Posted by DiapDealer View Post
That would be my only concern, too. But even then... I'd probably be willing to sacrifice the scene-breaks (or any other vertical spacing breaks) at that point just to get things cleaned up. I could always add them back in with CSS if I have an original document to compare to.
If the scene-breaks match with what the s&r would replace, i.e.
Code:
<p>&nbsp;<br /></p>
Do two search&replace
1. Search for
Code:
<p>&nbsp;<br /></p>
Replace
Code:
<p class="scenebreak">&nbsp;</p>
As original s&r
2. Search for
Code:
&nbsp;<br /></p>
Replace
Code:
</p>
Now you'll also have css styled scenebreaks
In your css file add the following
Code:
p.scenebreak {margin-bottom: 0.5em;}
You can adjust the height of the scenebreak by altering the margin value.
Perkin is offline   Reply With Quote
Old 06-26-2012, 04:57 AM   #10
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,793
Karma: 4027751
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
Quote:
Originally Posted by Perkin View Post
Now you'll also have css styled scenebreaks
In your css file add the following
Code:
p.scenebreak {margin-bottom: 0.5em;}
You can adjust the height of the scenebreak by altering the margin value.
But you can't make it smaller than 1 line in that way. I'd leave the margin at 0 and change the "height" property instead.
Jellby is online now   Reply With Quote
Old 06-26-2012, 05:12 AM   #11
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 639
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD
Quote:
Originally Posted by Jellby View Post
But you can't make it smaller than 1 line in that way. I'd leave the margin at 0 and change the "height" property instead.
You could, but as a scenebreak is usually used to show an change of place/perspective, they usually do need a 'gap' of more than a line-height to distinguish from just another paragraph, that's why I'd use the margin.

A case of multiple ways to skin a cat.
(poor Polly - avatar pic)
Perkin is offline   Reply With Quote
Old 06-26-2012, 05:29 AM   #12
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,793
Karma: 4027751
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
Then I'd use "height: 1.5em", that way all the space goes in a single place, and not split in height+margin (the final effect is the same, anyway )
Jellby is online now   Reply With Quote
Old 06-26-2012, 06:11 AM   #13
Alda
Connoisseur
Alda began at the beginning.
 
Posts: 74
Karma: 22
Join Date: Jun 2010
Device: none
Thanks for all the replies. I'm not sure what you mean by "scenebreak" - could you please clarify?

I guess what I was asking originally was whether this problem has something to do with pasting from Word, or whether it also happens when the doc is saved as html. I gather that not everyone has this problem or it would be addressed in the FAQs, so what did I do to have this come up?

Thanks!

Alda
Alda is offline   Reply With Quote
Old 06-26-2012, 06:29 AM   #14
Alda
Connoisseur
Alda began at the beginning.
 
Posts: 74
Karma: 22
Join Date: Jun 2010
Device: none
Another thing: when I look at this more closely I see that &nbsp;<br /> is rare. Usually it's just the &nbsp;

In that case, is it a question of eliminating the &nbsp; altogether?
Alda is offline   Reply With Quote
Old 06-26-2012, 06:47 AM   #15
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 1,703
Karma: 1356799
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
&nbsp; is just a non breaking space that means the words on either side and the space will always be displayed together. Sometimes it can cause an extra space but not mostly.

In code view you do a search and replace for &nbsp; and replace it with a space from the spacebar generally without harm. In fact I nearly always do so to eliminate unexpected ends of lines.

Try it and see what you have left.

You may have to do a little detective work. Find a paragraph where you have the problem and look at the styles which applied to it in the stylesheet. You may have it surrounded in <div>s which cover more than one paragraph, so look up and down and see if you can find a <div> which starts above and doesn't end until below it.
mrmikel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove white space between paragraphs for iPad? kabloooie Conversion 4 05-28-2012 05:11 AM
Removing space between paragraphs in a Mobi book HarryT Conversion 7 08-07-2011 10:42 AM
space between paragraphs gatorman Sigil 3 01-07-2011 10:17 AM
How to reduce indents without "removing space between paragraphs" Skydog Calibre 5 06-05-2010 12:58 AM
Removing unwanted white space JayLaFunk Sigil 4 03-19-2010 11:33 AM


All times are GMT -4. The time now is 11:22 AM.


MobileRead.com is a privately owned, operated and funded community.