|
|
#1 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Q:font-size -- hardcode or percent?
Learned a lot from just reading the posts.
Interesting comment/recommendation in one of the other threads lead me to wonder if basing font size (and maybe other parameters) on a percentage instead of hard coding it is recommended for the e-reader compatibility. I usually start out with my basic.css and hardcode h1 to be 2.5em (assuming that it will be 2.5x the paragraph font size) Q1: Does it matter if I use 2.5em or 250%? Q2: Should the percentage approach be applied to other parameters? Code:
/* --------------------------------------------------------------------------------------------------- text*/
p {
text-indent:2em;
text-align: left;
font-size: 1em;
margin-top:0;
margin-bottom: 1em;
font-weight: normal;
font-style: normal;
line-height:125%;
}
/* for the first <p> after the h1, h2, h3 */
h1 + p {text-indent:0;}
h2 + p {text-indent:0;}
h3 + p {text-indent:0;}
/* --------------------------------------------------------------------------------------------------- headings */
h1 {
page-break-before: always;
page-break-after: avoid;
text-indent: 0;
text-align: center;
margin-top:0;
margin-bottom: 1em;
font-size: 2.5em;
font-weight: bold;
font-style: normal;
color:blue;
}
h2 {
page-break-after: avoid;
text-indent: 0;
text-align: center;
margin-top:0em;
margin-bottom: 1em;
font-size: 2em;
font-weight: bold;
font-style: normal;
color:blue;
}
The family uses some flavor of Kindles, so I don't have to have 'global' compatibility, but I do like to do things right. Thanks Paul |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
There is no real difference in em or percentages for these usecases.
|
|
|
|
|
|
#3 |
|
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Sep 2013
Device: Kindle Touch
|
I use percentages myself. This gives control to the end user regarding font sizes. Normal text=100%, chapter heading 120% and so on. I also use 'generic' font names in my CSS, i.e. "serif", "sans-serif" or "monospace."
|
|
|
|
|
|
#4 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,257
Karma: 61916418
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I mostly use em except when I want an explicit fixed size.
My default (when needed IMHO for Charis fonts) line-height: 1.2; Is % valid? When specifying a font-family, I always include the generic 'fallback' style to use , just in case |
|
|
|
|
|
#5 |
|
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,245
Karma: 35164265
Join Date: May 2011
Location: PA {back in the usa!}
Device: Sony PRS-T2, ADE on PC
|
I am under the impression that it doesn't matter whether to use 1.2 em or 120%, they would both display the same. I don't see how using percentage would give any greater control to the "end-user" than using ems.
I started using percentage for font-size as an experiment, but will go back to using em. I find that I prefer to use percentages only when referring to MARGINS and LINE-HEIGHT (easier Find&Replace in the stylesheet) |
|
|
|
|
|
#6 |
|
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570
Karma: 20150435
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
For font sizes, 1.2em or 120% makes no difference. For margins there's a whole world of a difference between 1.2em and 120%
![]() I prefer to use 120% in font sizes, because it's (to me) clearer what the intent is. (And it's one character less with more precision )
|
|
|
|
|
|
#7 | |
|
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,245
Karma: 35164265
Join Date: May 2011
Location: PA {back in the usa!}
Device: Sony PRS-T2, ADE on PC
|
Jellby said:
Quote:
(We'll see if I change my mind again....) |
|
|
|
|
|
|
#8 |
|
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570
Karma: 20150435
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to change font size and font style? | butterbescotch | Sigil | 20 | 09-06-2013 09:22 PM |
| Determine font and font size on incoming epub? | peaceridge | Calibre | 4 | 01-30-2012 04:35 PM |
| Newbie question - Hardcode values on RegEx on import | PeterSm | Library Management | 1 | 10-04-2011 11:55 AM |
| Can't change font or font size in ereaders | jmacg | Sigil | 30 | 10-23-2010 10:21 PM |
| PRS-300 Med font size too big, but small font size too small | eli2k | Sony Reader | 4 | 05-28-2010 10:47 AM |