02-18-2015, 03:12 PM | #1 |
Member
Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
Margin ignored on most readers
Hello,
I'm trying to add some space between titles. I used "margin-top" value at my stylesheet. But when I test ebook with readers like Kindle, Aldiko and Sumatra, I see that margin value is ignored. Only reader correctly displaying margins is Adobe Digital Editions. I tried adding <br> between titles, but the space is too big this way. What is the proper way of doing this? Thanks |
02-18-2015, 03:56 PM | #2 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Are you by any chance using "page-break-before: always" or similar in the titles too? Top margins after forced pagebreaks can be discarded according to the spec.
|
02-18-2015, 05:18 PM | #3 |
Addict
Posts: 254
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
My memory, from a few years ago testing Android epub readers, is that Aldiko is based on ADE and honors CSS margins - unless that's changed in recent versions.
My kindle PW2, definitely does honor css margins with sideloaded azw3 books I've sent it from calibre. |
02-19-2015, 12:39 AM | #4 | |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Quote:
|
|
02-19-2015, 03:05 AM | #5 |
Member
Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
Hello,
Thanks for all replies. I have limited knowledge of CSS & HTML, probably I'm doing something wrong. I have created a selector like this at my stylesheet: .title { margin-top: 3px; } Then I applied the selector like this: <p class="title"><b>Rafting</b></p> Thanks |
02-19-2015, 03:23 AM | #6 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
There could be other styles with higher priority (in the bookr or implicitly used by the reader) that effectively cancel yours. Do you have other rules in the stylesheet? Are they being honored?
I suggest you use "<h?>" instead of "<p class="title"><b>" (with an appropriate number between 1 and 6 instead of the ?). |
02-20-2015, 12:28 AM | #7 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Have you set a top-margin for your pages?
For some reason unknown to me margin-top sometimes does not work to set the top of of a page, but padding-top does. Could you try using padding-top to see if that works? |
02-21-2015, 04:42 AM | #8 |
Member
Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
Thanks for replies. I tried it like this:
p.title { padding-top: 0.9em !important; margin-top: 0.9em !important; } Google Books and Adobe Digital Editions does honor, but Kindle & Aldiko still does not. I don't want to use <h?> tags because I am using it with paragraphs as well. |
02-21-2015, 07:03 AM | #9 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Something strange is going on here. Can you conjure up an example ePUB with this behavior?
|
02-23-2015, 07:03 AM | #10 |
Member
Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
I found this article at Amazon Kindle Direct Publishing help, maybe this is why margins are not displayed properly.
Margins At this time, Amazon KDP doesn't support margins set inside CSS/HTML (such as topmargin, leftmargin etc. set in px values). You can use the CSS margin attribute, but depending on your text format, this might not translate properly. Note: You can set only the left, top, and bottom margins this way, never the right margin. |
02-23-2015, 09:40 AM | #11 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
That makes sense. Margins in pixels are usually not that useful.
|
02-23-2015, 01:32 PM | #12 | |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
Dale |
|
02-23-2015, 02:14 PM | #13 | |
Resident Curmudgeon
Posts: 73,983
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
02-23-2015, 04:22 PM | #14 |
Member
Posts: 11
Karma: 10
Join Date: Jan 2015
Device: Kindle
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CSS: margin-top and margin | Leonatus | ePub | 16 | 06-16-2014 04:29 AM |
CSS margin instead of margin-top, etc. | icallaci | Conversion | 24 | 10-19-2013 09:52 AM |
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; } | cybmole | Conversion | 15 | 02-12-2011 11:57 AM |
Margin margin margin | Gray Eminence | ePub | 2 | 01-10-2011 11:17 AM |
calibre ignore margin-top and margin-bottom | bender | Calibre | 2 | 12-11-2009 06:58 AM |