Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-04-2013, 04:57 PM   #1
Kasper Hviid
Zealot
Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.
 
Posts: 141
Karma: 2784614
Join Date: Nov 2012
Device: none
How simple should I make the CSS?

It is my experience that whatever .epub I design will breaks a lot - images aren't displayed, fonts don't work, even a simple thing as italic text tends to break. And that is just on my own Kobo.

One thing I consider is to keep everything so simple that it cannot break - like typing in actual uppercase instead of using text-transform: uppercase;. Or use manual indenting instead of h2 + p { text-indent:0; }

But how far should I go? Is there any way of telling what CSS I can expect to be implemented on most readers?
Kasper Hviid is offline   Reply With Quote
Old 06-04-2013, 06:55 PM   #2
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
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
Many things work fine in CSS. There are bunches of CSS examples in the wiki specific for ePub. italic text should work everywhere but text-transform is not to be trusted. text-indent is the preferred way to indent, ePub does not support all CSS so you need to be sure what you want is supported and not all readers follow CSS instructions. If you avoid depending on cascade you will be better off. Do a check of your CSS file for errors. An error in the file will cause the entire file to be ignored on Adobe based readers.

Dale
DaleDe is offline   Reply With Quote
Advert
Old 06-05-2013, 03:10 AM   #3
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
text-transform, as DaleDe points out, is not included in the ePub spec, so you should not expect it to work, and in particular you should not depend on it.

visibility is another such property that would be useful in some cases.

font-variant:smallcaps, however should be supported, but it mostly isn't, so you should not rely on it either (but you can blame the readers, and Adobe in particular, for that). Same with pseudo-elements (:first-letter, :first-line).

auto margins will often not work as expected, because the spec allows them to be ignored, and they often are.

Complex selectors (h2 + p, div.poetry div.stanza p, etc) in my experience work fine, but they may fail in some reader. Just don't try to be too smart.
Jellby is offline   Reply With Quote
Old 06-05-2013, 07:05 AM   #4
Kasper Hviid
Zealot
Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.
 
Posts: 141
Karma: 2784614
Join Date: Nov 2012
Device: none
Both of you, thanks! :-)
So it's like this:

USE:
font-style: italic;
text-indent: 1.3em;
complex selectors (h2 + p, div.poetry, div.stanza p) mostly works, but don't get too smart.

AVOID:
text-transform: uppercase;
visibility: hidden;
font-variant:smallcaps; (but it *should* be supported)
margin: auto;
pseudo-elements (:first-letter, :first-line, :before ...).
Also avoid cascade


How about fonts? I guess that
font-family: sans-serif;
font-family: serif;
will be safe, but can I trust that any of the 'web-safe-fonts' are on the system?

And how about line-height and letter-spacing?

Last edited by Kasper Hviid; 06-05-2013 at 07:13 AM.
Kasper Hviid is offline   Reply With Quote
Old 06-05-2013, 07:30 AM   #5
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
Whatever fonts are on a reader is all there is unless you embed them into an epub. This increases the size, generally to not so much benefit. Many fonts, including some of those that come with a Windows system, are proprietary and can not be legally embedded without permission which is likely to cost more than you would make on a book. There are good non-proprietary fonts, and on Adobe's website is a list of their fonts that are embeddable.
mrmikel is offline   Reply With Quote
Advert
Old 06-05-2013, 09:59 AM   #6
Kasper Hviid
Zealot
Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.Kasper Hviid ought to be getting tired of karma fortunes by now.
 
Posts: 141
Karma: 2784614
Join Date: Nov 2012
Device: none
thanks mrmikel! By the way, my reader has:
- Amasis
- Avenir Next
- Caecilia
- Georgia
- Gill Sans
- Kobo Nickel
- Malabar
So basic "web safe fonts" like Arial and Times New Roman isn't supported. My guess is that one should just use either 'serif' or 'sans-serif' for .epub files that should be compatible on most devices ... for anything more precise, the fonts will need to be embedded.
Kasper Hviid is offline   Reply With Quote
Old 06-05-2013, 10:30 AM   #7
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 Kasper Hviid View Post
How about fonts? I guess that
font-family: sans-serif;
font-family: serif;
will be safe,
Results are unpredictable. If I remember correctly, in my reader all the "standard" font-families result in the default font (or one of a couple of default fonts), even though I can set my own preferred font.

That is, I install "Droid Serif" and use it happily... but then some book sets "font-family: serif", and I see the default Adobe font, instead of "Droid Serif". So, I'd say avoid them. Use only fonts if you are embedding them, and don't use embedded fonts for the main text.

Quote:
but can I trust that any of the 'web-safe-fonts' are on the system?
Certainly not. And you cannot trust they are on computers either. They are in some Windows versions, and in other systems only if the user actively installs them.

Quote:
And how about line-height and letter-spacing?
letter-spacing is not in ePub spec, I believe.
line-height is, but that's something a bit like font-size: you better let the user choose the right one and don't mess with it, unless for some special effect in some particular section (I use "line-height:0" for superscripts, to avoid uneven line spacing, for instance).
Jellby is offline   Reply With Quote
Old 06-05-2013, 11:26 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,987
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
One thing you cannot do on a Kobo is use font-family in the body style. It doesn't work. Kobo ignores it. You have to use font-family in other CSS styles such as p.

Code:
p {
font-family: Charis
margin-top: 0;
margin-bottom: 0;
text-indent: 1.2em
}
All p will be in the font you've chosen. This works. But in the body, it does not work. This is a long standing bug that Kobo feels it's OK to ignore when really, it's not.
JSWolf is offline   Reply With Quote
Old 06-05-2013, 06:18 PM   #9
SBT
Fanatic
SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.
 
SBT's Avatar
 
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
I suppose the watch-words are “graceful decay”: the text should remain readable even if some, or even all, of the stylesheet is ignored.
Ignored CSS is simple enough to handle. The real bugbear is when CSS is interpreted differently in separate readers (line-height seems to be particularly awkward)

I hasten to add that I myself spend very little effort attempting to live up to such a maxim. I make my epub books for the fun of it, and one of the really fun bits is messing around with the style sheet. Though maybe thus limiting “my” readership, I console myself with the thought that my uncompromising attitude may spur suppliers of epub readers to greater conformance (Yeah, right...)
SBT is offline   Reply With Quote
Old 06-05-2013, 07:24 PM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,987
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by SBT View Post
I suppose the watch-words are “graceful decay”: the text should remain readable even if some, or even all, of the stylesheet is ignored.
Ignored CSS is simple enough to handle. The real bugbear is when CSS is interpreted differently in separate readers (line-height seems to be particularly awkward)
Different Readers can have a different default line height. But, none of the ADE based Readers ignore line height in the CSS. So if you do need/want a specific line height, put it in the CSS and it will work.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
css to make all images larger? 1611mac ePub 5 03-31-2012 02:18 AM
How do you hide/make not-visible sections in CSS/epub? FatDog ePub 2 02-23-2012 05:54 PM
Simple Question for the CSS experts out there... Japes Calibre 2 06-23-2011 11:12 PM
Tweak epub and Simple CSS Editor Shadowman123 Calibre 11 09-30-2010 10:07 AM
How can I make a left-justify CSS for CoolReader? Sunspark Astak EZReader 1 06-07-2010 11:00 AM


All times are GMT -4. The time now is 01:37 PM.


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