08-20-2012, 03:57 PM | #1 |
Member
Posts: 15
Karma: 48138
Join Date: Aug 2012
Device: FBReader, Cool Reader and Aldiko (Android Tablet)
|
What dark art is this?
Fortunately for me, I have a brother who studied engineering, and he introduced me to the idea of a cascade error - something unobtrusive that causes unexpected behavior of code which is very difficult to trace, because it affects things that it is seemingly not directly related to.
CSS seems like something of a dark art to me: after figuring out the complexities of embedding a font (largely thanks to posts here), redefining the H1 entity (defined after the body entity in a single style sheet, as copied below) caused the body to add the same amount of line space as the H1. The line-height: 100%; was added to the body definition to correct this effect, but I don't understand why it should have been necessary. Does this make sense to anybody Code:
body {font-family:"Palatino Linotype", Georgia, serif; text-align: justify; line-height:100%; } h1 {font-family: "Palatino Linotype", serif; font-weight: normal; font-style: italic; font-weight: bold; color: rgb(24, 136, 173); text-align: center; line-height: 110%; } |
08-20-2012, 06:44 PM | #2 | |
Resident Curmudgeon
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
body { font-family:"Palatino Linotype", Georgia, serif; text-align: justify; margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; widows: 0; orphans: 0 } h1 { margin-top: 1em; margin-bottom: 1em; font-style: italic; color: rgb(24, 136, 173); text-align: center; } |
|
Advert | |
|
08-21-2012, 05:05 AM | #3 |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
@Kittybriton: Just checked it in Chrome browser window; I suppose you have noticed that default line height isn't necessarily 100% (in my case more?)
|
08-21-2012, 06:59 AM | #4 |
Member
Posts: 15
Karma: 48138
Join Date: Aug 2012
Device: FBReader, Cool Reader and Aldiko (Android Tablet)
|
Thanks JSWolf. Since Sigil likes to take care of errors itself (and I wasn't at my best after two very early starts), it may be that I wasn't careful about checking for changes that had been inserted automatically.
Yes, SBT, that is exactly what puzzled me when I checked it in Sigil and the Firefox ePub Reader plugin. What I still don't understand is why the line-height changed without me specifying anything that, as far as I can see, related to line-height. Before I started specifying the font, the line-spacing was unchanged. My first attempt, with the header definition before body, worked to select Palatino for the header, but was ignored in the body. I have a vague recollection from way back that when I glanced at the w3 consortium specs, they said something about precedence when defining entities, but at the time didn't take note of it. [postscript] Upon checking the XML code, I find that Sigil had decided the first paragraph should be in the h2 entity, rather than p. Corrected that, and the sun shines once more There are other questions I will need to answer if I am to decide whether to commit the time and energy necessary to learning the ePub format in depth, so another thread will probably be forthcoming. Looking for a quick answer rather than being diligent and Googling, can anyone tell me, does the ePub format support the use of Javascript? Found a satisfactory answer pro tem, i.e. possibly in more advanced versions, but best avoided. Last edited by Kittybriton; 08-21-2012 at 07:23 AM. Reason: addendum and corrigenda |
08-21-2012, 07:20 AM | #5 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Checking things in Sigil and Firefox may not be sufficient. You might check it in your device as well, because the rendering engines for Sigil and Firefox can vary from your device and other different devices.
|
Advert | |
|
08-21-2012, 07:23 AM | #6 |
Member
Posts: 15
Karma: 48138
Join Date: Aug 2012
Device: FBReader, Cool Reader and Aldiko (Android Tablet)
|
Thanks Mrmikel, yes, I am trying to check the output in as many devices as I can beg or borrow, knowing that not all readers are created equal.
|
Tags |
css |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Free online read (urban fantasy) from Pocket After Dark - Surrender the Dark | Susan Crealock | Deals and Resources (No Self-Promotion or Affiliate Links) | 2 | 12-12-2014 08:33 PM |
Google Art | Hamlet53 | Lounge | 1 | 05-28-2011 08:10 PM |
Free online read (paranormal romance) from Pocket After Dark - Dark Protector | Susan Crealock | Deals and Resources (No Self-Promotion or Affiliate Links) | 0 | 05-15-2011 01:10 AM |
Art For Cover | genepool | Writers' Corner | 4 | 01-28-2011 09:44 PM |
Unutterably Silly Art de Forums | Godzil | Lounge français | 16 | 06-11-2010 11:31 AM |