05-25-2013, 12:11 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: May 2013
Device: Kindle Touch
|
Problem with Styles
I'm working on an eBook for a client and have it almost completed except for one strange problem.
It seems like half the time my styles are being ignored. Everything looks great on KF8 devices. The problem is in the older mobi7 part. I have my main styles set up with a 1.5em text indent. But there are a few places where I don't want an indent (like the first paragraph of a chapter). Here are the main classes I'm using: .maintext { font-size: 1em; margin-bottom: 0.2em; margin-left: 0; margin-right: 0; margin-top: 0; text-indent: 1.5em } .maintextspace { font-size: 1em; margin-bottom: 1em; margin-left: 0; margin-right: 0; margin-top: 0; text-indent: 1.5em } And if I want to have no indent I have: p.noindent {text-indent: 0} Now, when I combine the 'maintext' with the 'noindent' it works fine and shows up with no indent. However, when I combine the 'maintextspace' and 'noindent' it show up with an indent. Here's how I have it in the text of the book: <p class="maintextspace noindent">text here</p> or <p class="maintext noindent">text here</p> I can not figure out why one is working and the other isn't. They are identical expect for the 'margin-bottom'. Please help? A little more info: I'm using Sigil to code the ePub and then using KindleGen to create the mobi file. Both the ePub and KF8 version are working, only the mobi7 is giving me these problems. |
05-25-2013, 04:55 AM | #2 |
frumious Bandersnatch
Posts: 7,524
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
MOBI (mobi7, I guess) does not support CSS at all. It's all the work of the converter if it looks like it does, and maybe the converter is buggy, try another one (like calibre).
But anyway, why use ".maintext" at all? This is simpler: Code:
p { font-size: 1em; /* I'm pretty sure this is redundant */ margin: 0 0 0.2em 0; text-indent: 1.5em; } .space { margin-bottom: 1em; } .noindent { text-indent: 0; } |
Advert | |
|
05-25-2013, 12:56 PM | #3 |
Wizard
Posts: 1,581
Karma: 7043711
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
I couldn't reproduce your issue. After using your styles, in Kindle Previewer (and selecting Kindle or Kindle for iPad as device), I can't see any indent by using the class "maintextspace noindent".
However, try using the property "!important" to see if with that your problem is fixed. Try using: p.noindent {text-indent: 0 !important;} But I repeat you, with Kindle Prewiever, all works fine for me. |
05-25-2013, 03:02 PM | #4 |
Junior Member
Posts: 4
Karma: 10
Join Date: May 2013
Device: Kindle Touch
|
I used KindleUnpack to take a look at the html of the mobi7 file (to see how the css is being translated into html).
There are either <p width="0"> or <p width="2"> on the paragraphs. I understand that it's rounding up my 1.5em (since mobi7 doesn't do fractions of ems). But here's where I get even more confused. Here's a short sample of the one of the problem texts from the mobi7 html: <p width="0em">With camera love,</p> <div height="1em"></div> <p width="0em">Nikki</p> <div height="1em"></div> <p width="0">p.s. I would love to hear your feedback on this sample chapter. (contact info removed).</p> From my understanding that should result in three paragraphs with no indents with a space between them. However, when I open the mobi in Kindle Previewer all the non-KF8 devices are showing that as the first two paragraphs are indented, and the last one is not. I noted that the two contain the em unit while the other doesn't. But that shouldn't matter, right? I thank everyone for the help! I think, in the end, I'm just going to write new classes so I won't have to combine any. I just can't understand why this is working only some of the time. |
05-25-2013, 08:09 PM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: May 2013
Device: Kindle Touch
|
The "!important" property worked! Everything's coming out the way I want it to now.
Thank you so very much! |
Advert | |
|
05-25-2013, 09:28 PM | #6 |
Wizard
Posts: 1,581
Karma: 7043711
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
06-08-2013, 10:43 AM | #7 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I haven't experienced this problem, to the best of my knowledge. (I don't actually own a K1, K2, or early model K3; I rely on the "Kindle" emulation in Kindle Previewer.)
My "no indent" paragraph style is actually called "first," and this is the style: p.first { margin-top:0.5em; margin-bottom: 0.0em; text-indent:0.0em; text-align:justify; } |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CSS Styles From InDesign 5.5 Export Problem | SamL | ePub | 4 | 11-10-2011 01:46 PM |
Problem with calibre ignoring font styles | ndr | Conversion | 4 | 10-09-2011 12:51 PM |
<hr /> styles | trstill | Introduce Yourself | 1 | 05-30-2010 01:57 PM |
So many styles! | roger64 | Calibre | 3 | 03-21-2010 08:05 AM |
Wiki and styles | tribble | Feedback | 1 | 10-20-2006 05:46 AM |