Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 02-25-2015, 11:01 AM   #1
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Top-margin (bottom-margin?) for Kobo?

I see that my CSS styles don't seem to work on Kobo books. For example:

p.first {
margin-top:0.5em;
margin-bottom: 0.0em;
text-indent:0.0em;
text-align:justify;
}

creates a line that immediately follows the line above, without the 0.5 em space.

Is there another way to gain some breathing space, or should I just live with it?
Notjohn is offline   Reply With Quote
Old 02-25-2015, 11:19 AM   #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,548
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The only time I've ever really seen margin-top be outright ignored is when it's applied to the first element immediately following a soft (css) page-break. Are you sure there's not an error somewhere else in your css that's causing the entire thing to be ignored? Use the W3C CSS validation feature of Sigil to be sure there's no syntax errors anywhere.

Last edited by DiapDealer; 02-25-2015 at 11:23 AM.
DiapDealer is offline   Reply With Quote
Old 02-25-2015, 05:09 PM   #3
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
Is it just the top margin that isn't working - what about the indentation and justification ?

If none of the css is working double check you have linked in to the correct css stylesheet. I spent an age trying to work out why some styles didn't work only to realise my text file wasn't correctly linked to the relevant stylesheet.

Also worth using the "inspector" to see the order in which css rules are being applied to your text, something may be overriding the p.first declaration.

BobC
BobC is offline   Reply With Quote
Old 02-25-2015, 10:53 PM   #4
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Notjohn View Post
I see that my CSS styles don't seem to work on Kobo books.
creates a line that immediately follows the line above, without the 0.5 em space.

Is there another way to gain some breathing space, or should I just live with it?
Works ok in Sigil and Calibre's viewers, as you probably already know.

What is your "p" definition?

Any effect if you bump up the margin to 5 em?

Sigil's preview window includes a code view that shows you the final calculated CSS for each paragraph.
Calibre's reader also has an "Inspector" that does the same.
Can be helpful to find a missing quote mark or bracket in your code.


But if it's a "feature" of Kobo then you just have to work around it.
eg S&R all
<p class="first">
to
<p class="first"><br/>

or insert a whole para.
<p class="spacer">&nbsp;</p><p class="first">

define "spacer" line-height or font-size and see if that gives you any control over the spacing.

The nbsp is because some readers completely ignore empty paras.

Last edited by AlanHK; 02-25-2015 at 10:57 PM.
AlanHK is offline   Reply With Quote
Old 02-26-2015, 05:01 AM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
My Kobo's have no issue with code like that with either the epub or kepub reader. And, except for the justify, I have something like that in most books I fiddle with. It's probably an error. The Kobo firmware can be unforgiving for errors, especially the epub reader.

Any chance of a sample epub to look at? I think we need to see the rest of the code to see what is happening.
davidfor is offline   Reply With Quote
Old 02-26-2015, 04:12 PM   #6
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
The first-paragraph style:

p.first {
margin-top:0.5em;
margin-bottom: 0.0em;
text-indent:0.0em;
text-align:justify;
}

The chapter-heading style:

h2 {
margin-top:1em;
font-size: 150%;
text-indent: 0em;
font-style: italic;
text-align:center;
}


I've been told elsewhere that stripping out margin-top is standard for Kobo. (Perhaps significant: I uploaded this e-book through Draft2Digital.)

I'll look at some other Kobo samples to see if they exhibit the same behavior. Note that I'm doing this on my Windows 7 desktop, not on a Kobo reader.

Later: okay, I previewed The Girl on the Train, and it exhibits identical behavior: no margin-top, though the Look Inside sample on Amazon does show it.

Thanks!

Last edited by Notjohn; 02-26-2015 at 04:20 PM.
Notjohn is offline   Reply With Quote
Old 02-26-2015, 04:39 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,548
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Notjohn View Post
I've been told elsewhere that stripping out margin-top is standard for Kobo. (Perhaps significant: I uploaded this e-book through Draft2Digital.)
You've been informed in the preceding post (by someone with actual Kobo devices) that this is NOT "standard" Kobo behavior. I suppose you're under no obligation to believe them, though.
DiapDealer is offline   Reply With Quote
Old 02-26-2015, 11:28 PM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Notjohn View Post
The first-paragraph style:

p.first {
margin-top:0.5em;
margin-bottom: 0.0em;
text-indent:0.0em;
text-align:justify;
}

The chapter-heading style:

h2 {
margin-top:1em;
font-size: 150%;
text-indent: 0em;
font-style: italic;
text-align:center;
}
As stated above, I put styles very similar to this in books that I fiddle with. And I've seen similar in many books purchased from Kobo.
Quote:
I've been told elsewhere that stripping out margin-top is standard for Kobo. (Perhaps significant: I uploaded this e-book through Draft2Digital.)
When do they claim the margin-top is being stripped? I assumed you meant that it was being ignored by the Kobo readers, but this makes me think you mean something else. Are they claiming that Kobo is stripping them when converting to kepub?
Quote:
I'll look at some other Kobo samples to see if they exhibit the same behavior. Note that I'm doing this on my Windows 7 desktop, not on a Kobo reader.
Edit: I noticed the above after I posted.

What are you using to view the books? The Kobo desktop application?
Quote:
Later: okay, I previewed The Girl on the Train, and it exhibits identical behavior: no margin-top, though the Look Inside sample on Amazon does show it.
I'm hoping you mean "The Girl on the Train" by Paula Hawkins. That was the first result from a search on the Kobo site and my Aura H2O. There were at least four other books with the same title. I grabbed the preview and took the attached screenshots. Comparing them to the Amazon versions shows they are different. But, they are different editions, so they can't really be compared. And, I can see two versions on Amazon with different formatting.

The code for the start of the chapter is:

Code:
   <div xmlns="http://www.w3.org/1999/xhtml" id="book-columns">
      <div xmlns="http://www.w3.org/1999/xhtml" id="book-inner">
        <h2 class="chapter_head">
          <span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.1.1">RACHEL</span>
        </h2>
        <h3 class="a_head_left">
          <em>
            <span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.2.1">Friday, 5 July 2013</span>
          </em>
        </h3>
        <h4 class="b_head_center">
          <em>
            <span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.3.1">Morning</span>
          </em>
        </h4>
        <p class="flush_left">
          <span class="small">
            <span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.4.1">THERE IS A</span>
          </span>
          <span xmlns="http://www.w3.org/1999/xhtml" class="koboSpan" id="kobo.5.1">pile of clothing on the side of the train tracks.</span>
The styles are:

Code:
h2.chapter_head
{
	text-indent: 0;
	text-align: center;
	page-break-after: avoid;
	margin-top: 10%;
	margin-bottom: 2em;
}
h3.a_head_left
{
	text-indent: 0;	
	text-align: left;	
	page-break-after: avoid;
	margin-top: 1.5em;
	margin-bottom: 1em;
}
h4.b_head_center
{
	font-size:1.1em;
	text-indent: 0;	
	text-align: left;	
	page-break-after: avoid;
	margin-bottom: .5em;
}
p.flush_left
{
	text-indent: 0;
	margin-top: 0;
	margin-bottom: 0;
}
p.indented
{
	text-indent: 1em;
	margin-top: 0;
	margin-bottom: 0;
}
I can see "margin-top"s in there and they seem to be doing what they are supposed to do.
Attached Thumbnails
Click image for larger version

Name:	screen_001.png
Views:	489
Size:	138.1 KB
ID:	135372   Click image for larger version

Name:	screen_002.png
Views:	521
Size:	151.0 KB
ID:	135373  
davidfor is offline   Reply With Quote
Old 02-27-2015, 06:25 AM   #9
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Thank you. Perhaps it was all a false alarm: I didn't "grab a sample" but clicked on the Preview on the Kobo store. I will look at The Girl on the Train (yes, Hawkins's best-seller) on the Kobo PC viewer.
Notjohn is offline   Reply With Quote
Old 02-27-2015, 06:47 AM   #10
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Just looked at the preview on the Kobo store and desktop app. The store seems to be setting the top and bottom margins to zero. The desktop app looks pretty much the same as the above screen shots.
davidfor is offline   Reply With Quote
Old 02-27-2015, 07:07 AM   #11
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
I have taken the css from the posts above and used them to construct a simple book. The EPUB is attached.

I run this through Calibre to produce a kepub and transferred it to my Glo.

The top-margin works exactly as expected.

What results do you get ?

This proves conclusively that Kobo hardware does not ignore valid top-margin declarations. If this is happening with your book there must be something overriding it or some other error in the book's construction.

BobC
Attached Files
File Type: epub Top Margin test.epub (2.1 KB, 297 views)
BobC is offline   Reply With Quote
Old 02-27-2015, 07:44 AM   #12
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
If you're trying to set up the common style of indenting all paragraphs but the first, is there any reason not to simply use:

p { text-indent: 0; margin: 0.5 em 0 0 0; }

p + p { text-indent: 1.7em; margin: 0; }

Though the margin-bottom setting of your h1 etc. style should take care of spacing above the first lines of a chapter or titled section.

Last edited by exaltedwombat; 02-27-2015 at 07:50 AM.
exaltedwombat is offline   Reply With Quote
Old 02-27-2015, 04:19 PM   #13
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Quote:
Originally Posted by davidfor View Post
Just looked at the preview on the Kobo store and desktop app. The store seems to be setting the top and bottom margins to zero. The desktop app looks pretty much the same as the above screen shots.
Thanks. That's certainly what I've been seeing, on all books, not just on my own.

I was somewhat surprised to find that Kobo doesn't seem to have a downloadable sample--not that it would do me a whole lot of good, since neither does it seem to have a desktop app for anything other than Windows 8!
Notjohn is offline   Reply With Quote
Old 02-27-2015, 06:43 PM   #14
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Notjohn View Post
I was somewhat surprised to find that Kobo doesn't seem to have a downloadable sample--not that it would do me a whole lot of good, since neither does it seem to have a desktop app for anything other than Windows 8!
Kobo do have preview samples. They are downloadable to their ereaders, iOS, Android and Win8 apps and their desktop applications. The desktop applications are available for Windows and Mac. For some reason there isn't a link to the desktop application on their apps page. It is at https://www.kobo.com/desktop.
davidfor is offline   Reply With Quote
Old 02-28-2015, 06:43 AM   #15
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Thank you! (Kobo certainly makes it difficult to get on board....) I have downloaded the desktop app an d several samples and find that, yes, unlike the online previews, they do obey margin-top. In fact, the books look very good indeed.
Notjohn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Margin bottom, top problem on tablet zs55 Reading and Management 7 05-23-2013 06:20 AM
margin top, bottom, additive or not ? cybmole Conversion 5 02-16-2011 12:33 PM
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; } cybmole Conversion 15 02-12-2011 11:57 AM
anyway to change Kindle top/bottom margin? cdpango Kindle Developer's Corner 2 11-28-2010 08:20 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 06:58 AM


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


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