Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-06-2013, 07:55 AM   #1
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
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
phossler is offline   Reply With Quote
Old 09-06-2013, 09:04 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
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.
Toxaris is offline   Reply With Quote
Advert
Old 09-06-2013, 09:40 AM   #3
Matt Butts
Junior Member
Matt Butts began at the beginning.
 
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."
Matt Butts is offline   Reply With Quote
Old 09-06-2013, 10:05 AM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,782
Karma: 54830978
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
theducks is offline   Reply With Quote
Old 09-09-2013, 02:43 AM   #5
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 3,200
Karma: 34977896
Join Date: May 2011
Location: JAPAN (US expatriate)
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)
GrannyGrump is offline   Reply With Quote
Advert
Old 09-09-2013, 03:54 AM   #6
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,515
Karma: 18512745
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 )
Jellby is offline   Reply With Quote
Old 09-09-2013, 04:32 AM   #7
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 3,200
Karma: 34977896
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
Jellby said:
Quote:
For margins there's a whole world of a difference between 1.2em and 120%
Agreed! --- that's part of my new strategy --- I'm using em for top and bottom margin, and percentage for side margins. I find it easier to read in the stylesheet, too.

(We'll see if I change my mind again....)
GrannyGrump is offline   Reply With Quote
Old 09-09-2013, 12:00 PM   #8
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,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by grannyGrumpy View Post
I'm using em for top and bottom margin, and percentage for side margins.
Note that percentages in vertical margins are referred to the width of the element, not the height. Otherwise it would be very difficult to have even margins on all sides.
Jellby is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change font size and font style? butterbescotch Sigil 20 09-06-2013 08:22 PM
Determine font and font size on incoming epub? peaceridge Calibre 4 01-30-2012 03:35 PM
Newbie question - Hardcode values on RegEx on import PeterSm Library Management 1 10-04-2011 10:55 AM
Can't change font or font size in ereaders jmacg Sigil 30 10-23-2010 09:21 PM
PRS-300 Med font size too big, but small font size too small eli2k Sony Reader 4 05-28-2010 09:47 AM


All times are GMT -4. The time now is 03:58 PM.


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