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

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 05-25-2013, 12:11 AM   #1
meg2157
Junior Member
meg2157 began at the beginning.
 
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.
meg2157 is offline   Reply With Quote
Old 05-25-2013, 04:55 AM   #2
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: 6,202
Karma: 4801165
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;
}
And you just use <p>, <p class="noindent">, <p class="space"> or <p class="space noindent">. But it might have the same problem upon conversion.
Jellby is offline   Reply With Quote
Old 05-25-2013, 12:56 PM   #3
RbnJrg
Evangelist
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 461
Karma: 318996
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.
Attached Thumbnails
Click image for larger version

Name:	Kindle iPad.jpg
Views:	52
Size:	143.4 KB
ID:	106251  
Attached Files
File Type: epub Test.epub (2.6 KB, 28 views)
RbnJrg is offline   Reply With Quote
Old 05-25-2013, 03:02 PM   #4
meg2157
Junior Member
meg2157 began at the beginning.
 
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.
meg2157 is offline   Reply With Quote
Old 05-25-2013, 08:09 PM   #5
meg2157
Junior Member
meg2157 began at the beginning.
 
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!
meg2157 is offline   Reply With Quote
Old 05-25-2013, 09:28 PM   #6
RbnJrg
Evangelist
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 461
Karma: 318996
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by meg2157 View Post
The "!important" property worked! Everything's coming out the way I want it to now.

Thank you so very much!
You are welcome!
RbnJrg is offline   Reply With Quote
Old 06-08-2013, 10:43 AM   #7
Notjohn
Addict
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: 221
Karma: 246332
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;
}
Notjohn 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
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


All times are GMT -4. The time now is 07:20 AM.


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