View Single Post
Old 06-02-2013, 10:54 PM   #16
52novels
Junior Member
52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.52novels got an A in P-Chem.
 
52novels's Avatar
 
Posts: 6
Karma: 6268
Join Date: Jul 2010
Location: NW Ohio
Device: Yes
Quote:
Originally Posted by William Ockham View Post
There's no way that I have found to precisely duplicate the ":first-line" pseudo class. I've taken to wrapping x words in a span (where x is a number between 4 and 8) and styling them inside a amzn-mobi media query).
Code:
p:first-of-type::first-line {
    font-weight: normal;
    font-variant: small-caps;
 }
To see an example of this in commercially-available Kindle book, get the sample for Blake Crouch's ABANDON (http://www.amazon.com/Abandon-ebook/dp/B00ARJLYE0). There's enough of the sample to see this work in KF8 devices and apps. I chose not to make this book fully backward compatible for legacy MOBI, so the CSS above displays the first line text in sentence case. I suppose the "conventional" way of making small caps with spans and a media query could be done for these, but the project's constraints didn't afford a lot of time to try. Plus, I figured, the issue will eventually resolve itself over time and that readers using the legacy systems weren't going to be adversely affected by the absence of small caps.

One additional note: I didn't want the first line of the first <p> tag in the author's bib page and copyright page to have small caps. As such, I added a selector (p.chapstart:first-of-type::first-line) to limit this effect to certain pages. It may be somewhat inefficient and add more specificity than I'd like, but it worked and the author loved it so I shipped. /shrug
52novels is offline   Reply With Quote