Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 12-07-2014, 09:16 AM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,495
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
:firstletter

Hi

Some years ago, if I remember, ADE 1.7. did not agree with :firstletter. It seems it now can use it.

So, imagine a book with h1 chapters. I wish to insert some dropcaps.
Code:
h1 + p {color:red;}
paints the first paragraph following a h1 title in red.

Code:
.firstletter:first-letter {color:red;}
does the same trick for the first letter of a paragraph.

Question: I would like to insert a CSS code which gives a
Code:
class="firstletter"
to the first paragraph of each h1 title. Or maybe I need a regex for that? I am confused.

Last edited by roger64; 12-07-2014 at 09:51 AM. Reason: code
roger64 is offline   Reply With Quote
Old 12-07-2014, 10:10 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: 3,183
Karma: 7180223
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
:firstletter is still not supported in ePUB2, so don't count on it working for readers...

You could try:
Code:
h1 + p.firstletter:first-letter {color:red;}
That should work I think for readers that support this.
Toxaris is offline   Reply With Quote
Old 12-07-2014, 10:11 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: 6,316
Karma: 4963983
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by roger64 View Post
Code:
.firstletter:first-letter {color:red;}
does the same trick for the first letter of a paragraph.
Only for paragraphs (or any other element) with class="firstletter".

Quote:
Question: I would like to insert a CSS code which gives a
Code:
class="firstletter"
to the first paragraph of each h1 title. Or maybe I need a regex for that? I am confused.
You can use selectors:

Code:
h1 + p:first-letter {color:red;}
This makes red the first letter or any paragraph immediately following an h1, whatever their classes are.

But, even if first-letter is supported, it's not flexible enough (for my needs), especially regarding punctuation preceding the first letter (think quotation marks, dashes, or Spanish question/exclamation marks), and cases where you need to use another element for the text following the first letter.
Jellby is offline   Reply With Quote
Old 12-07-2014, 11:06 AM   #4
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,495
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
OK

I thought the problem with first-letter use was just about ADE. I had the feeling :first-letter had been around for ages and did not know it was not EPUB 2 compliant.

Thanks for your answers, so the fruit is not yet ripe. For those who may be interested, I posted a nine minutes video -in French- on the French language forum about a more "classical" method to insert dropcaps (but it's mostly about writer2xhtml). I will keep this technique for sometime.

http://www.mobileread.com/forums/sho...&postcount=258


Last edited by roger64; 12-07-2014 at 11:22 AM. Reason: writer2xhtml
roger64 is offline   Reply With Quote
Old 12-07-2014, 01:42 PM   #5
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: 6,316
Karma: 4963983
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by roger64 View Post
I had the feeling :first-letter had been around for ages and did not know it was not EPUB 2 compliant.
It is ePub 2 compliant, as far as I remember. Reading systems are required to support all CSS 2 selectors, including pseudo-classes and pseudo-elements. Real life is different, though.
Jellby is offline   Reply With Quote
Old 12-07-2014, 03:38 PM   #6
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: 3,183
Karma: 7180223
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-300, PRS-T1
Quote:
Originally Posted by Jellby View Post
It is ePub 2 compliant, as far as I remember. Reading systems are required to support all CSS 2 selectors, including pseudo-classes and pseudo-elements. Real life is different, though.
Is it? My mistake then. Never encountered that it was supported though...
Toxaris is offline   Reply With Quote
Old 12-07-2014, 03:56 PM   #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: 6,316
Karma: 4963983
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
http://www.idpf.org/epub/20/spec/OPS...htm#Section3.1

Reading Systems must support all CSS2 selectors, including pseudo-elements and pseudo-classes. However, certain pseudo-classes may not be applicable to all Reading Systems (e.g. hover for devices with a touch screen) and may not result in any rendering on such devices.

And :first-letter is indeed a CSS2 selector:

http://www.w3.org/TR/2008/REC-CSS2-2.../selector.html
Jellby is offline   Reply With Quote
Old 12-07-2014, 04:00 PM   #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: 38,530
Karma: 19637653
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
It does not work in Bluefire Reader which is using the RMDSK from ADE 3.x. It also does not work in ADE 2.01.
JSWolf is offline   Reply With Quote
Old 12-07-2014, 09:38 PM   #9
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,495
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
Thank you all for these informations. :first-letter will wait...
roger64 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump


All times are GMT -4. The time now is 12:54 PM.


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