Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-25-2012, 06:45 PM   #1
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
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: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
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 online now   Reply With Quote
Old 06-25-2012, 06:59 PM   #3
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
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: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
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 online now   Reply With Quote
Old 06-25-2012, 07:10 PM   #5
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
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
Well trained by Cats
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: 29,807
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
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 offline   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: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
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 online now   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: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
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: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
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: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
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 offline   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: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
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: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
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 offline   Reply With Quote
Old 06-26-2012, 06:11 AM   #13
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
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
Zealot
Alda began at the beginning.
 
Posts: 104
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
Color me gone
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: 2,089
Karma: 1445295
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


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 06:39 PM.


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