Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-11-2024, 11:40 PM   #1
m_pluto
Member
m_pluto began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jun 2021
Device: Kobo Sage
First Line Pseudo Element in epubs

Hey ya'll, so I am in the midst of a trying to figure something out with the css of my epubs. (for background info, I have a kobo sage)

I really like my the first line of the first paragraphs in chapter/section to have "font-variant: small-caps" using first-line pseudo element, I also like to have page breaks before subheadings/section titles when they occur in the middle of a chapter.

My dilemma is this: I understand kepubs do not support page breaks, and epubs do, but one thing I have not been able to figure out is if epubs support the pseudo element first-line. I know for sure kepubs do, as I've had that working for a while, but I haven't been able to get first-line working on epubs..... Is there a way to get this to work?

edit to add in case it matters, these are all epub3s....
m_pluto is offline   Reply With Quote
Old 03-12-2024, 07:00 AM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Yes, it works fine on ePubs. I’ve been using it for years. The question is whether or not your device supports the css…
Spoiler:

This is what I use:
Code:
p.first::first-line {font-variant:small-caps}

<p class="first">This is the first paragraph in the chapter.</p>

The Kobo uses different rendering software depending if it is loaded as a kepub vs. an ePub. That’s why you may be seeing a difference.

I’m not a kobo user - maybe someone else has a better answer - but can you update the software/firmware on the kobo??
Turtle91 is offline   Reply With Quote
Old 03-12-2024, 07:22 AM   #3
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: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by m_pluto View Post
Hey ya'll, so I am in the midst of a trying to figure something out with the css of my epubs. (for background info, I have a kobo sage)

I really like my the first line of the first paragraphs in chapter/section to have "font-variant: small-caps" using first-line pseudo element, I also like to have page breaks before subheadings/section titles when they occur in the middle of a chapter.

My dilemma is this: I understand kepubs do not support page breaks, and epubs do, but one thing I have not been able to figure out is if epubs support the pseudo element first-line. I know for sure kepubs do, as I've had that working for a while, but I haven't been able to get first-line working on epubs..... Is there a way to get this to work?

edit to add in case it matters, these are all epub3s....
Kobo uses two different programs to render ePub and KePub. Pseudo elements do not work with ePub. Also, small-caps do not work with ePub.

If KePub does not like your page breaks, then the only thing you can do is use the editor to split the pages as needed.
JSWolf is offline   Reply With Quote
Old 03-12-2024, 07:54 AM   #4
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,544
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by m_pluto View Post
Hey ya'll, so I am in the midst of a trying to figure something out with the css of my epubs. (for background info, I have a kobo sage)

I really like my the first line of the first paragraphs in chapter/section to have "font-variant: small-caps" using first-line pseudo element, I also like to have page breaks before subheadings/section titles when they occur in the middle of a chapter.

My dilemma is this: I understand kepubs do not support page breaks, and epubs do, but one thing I have not been able to figure out is if epubs support the pseudo element first-line. I know for sure kepubs do, as I've had that working for a while, but I haven't been able to get first-line working on epubs..... Is there a way to get this to work?

edit to add in case it matters, these are all epub3s....
On epub3 first-line pseudo elements is honored. On Kobo for Android and iOS, works for both, epub and kepub. But I don't know if the rendering engine of your Kobo Sage have been updated with the last version.

Regarding page breaks, use the following code:

Code:
.pageBreak {
   -webkit-column-break-before: always;
   page-break-before: always;
   break-before: always;
}
RbnJrg is offline   Reply With Quote
Old 04-05-2024, 02:16 PM   #5
m_pluto
Member
m_pluto began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jun 2021
Device: Kobo Sage
Quote:
Originally Posted by RbnJrg View Post
On epub3 first-line pseudo elements is honored. On Kobo for Android and iOS, works for both, epub and kepub. But I don't know if the rendering engine of your Kobo Sage have been updated with the last version.

Regarding page breaks, use the following code:

Code:
.pageBreak {
   -webkit-column-break-before: always;
   page-break-before: always;
   break-before: always;
}
Will that work with kepubs, epubs, or both?
m_pluto is offline   Reply With Quote
Old 04-06-2024, 01:42 AM   #6
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,544
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by m_pluto View Post
Will that work with kepubs, epubs, or both?
Both. The first and last properties are for kepubs (and epub3); the second property for epubs (epub2).
RbnJrg is offline   Reply With Quote
Old 04-06-2024, 05:20 AM   #7
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: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Pseudo elements will NOT work on the version of RMSDK used on a Kobo Reader. You need to use a <span>.
JSWolf is offline   Reply With Quote
Old 04-06-2024, 07:35 PM   #8
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
You, of course, can continue to use the pseudo-elements, they just might not work. Assuming the Kobo is standards-compliant it will just not render with the pseudo-element css. It should just ignore that coding completely. You can, and should, set your css so that your book still looks acceptable if there is any coding that gets ignored.

If a device doesn't follow the standards then submit a complaint/bug report so they can get it fixed.
Turtle91 is offline   Reply With Quote
Old 04-08-2024, 05:44 AM   #9
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: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
You, of course, can continue to use the pseudo-elements, they just might not work. Assuming the Kobo is standards-compliant it will just not render with the pseudo-element css. It should just ignore that coding completely. You can, and should, set your css so that your book still looks acceptable if there is any coding that gets ignored.

If a device doesn't follow the standards then submit a complaint/bug report so they can get it fixed.
The only way for Kobo to fix RMSDK to allow pseudo elements is for Kobo to update RMSDK to the latest version and I cannot see that happening.

If this is an eBook for sale or to be read as ePub on a Kobo, then pseudo elements cannot be. A <span> will have to be used instead.
JSWolf is offline   Reply With Quote
Old 04-08-2024, 08:31 AM   #10
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by JSWolf View Post
The only way for Kobo to fix RMSDK to allow pseudo elements is for Kobo to update RMSDK to the latest version and I cannot see that happening.

If this is an eBook for sale or to be read as ePub on a Kobo, then pseudo elements cannot be. A <span> will have to be used instead.
That may, or may not, be the case. If Kobo chooses to produce devices that don't support standard CSS then that is a marketing decision and they will reap the results of a substandard product. Letting them know, through bug reports, that the customer isn't happy is a sure fire way they will get the message.

All of that does not change what I said. You should always design your css to include fallback coding so that it still looks acceptable.
Turtle91 is offline   Reply With Quote
Old 04-08-2024, 02:16 PM   #11
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Turtle91 View Post
That may, or may not, be the case. If Kobo chooses to produce devices that don't support standard CSS then that is a marketing decision and they will reap the results of a substandard product. Letting them know, through bug reports, that the customer isn't happy is a sure fire way they will get the message.
Which version of ePub and supported CSS are you suggesting? For instance, Standard Ebooks in their Advanced ePub ebooks use the latest and, possibly, greatest CSS allowed by the ePub 3.3 standard. Few current ePub readers seem to be capable of handling that code other than the standard "I don't know what it is so I will treat it as a null operation".
DNSB is offline   Reply With Quote
Old 04-08-2024, 04:27 PM   #12
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Why, all of them, of course!

The devices should be maintained with soft/firm-ware updates with the latest versions. They also need to be backwards compatible to support all the older books. The opf states what version (2/3) the epub is, so it shouldn't be too hard for a reader to apply the correct function...if there are any differences.

Pseudo elements, in particular, have been around for a very long time. A device that doesn't support that css is, imho, broken...

That standard of treating unknowns as a null operation is to prevent books from crashing. If your device is old (no longer supported and/or company is out of business), or can't do color (eink), or something, then the device would ignore that css.

Last edited by Turtle91; 04-08-2024 at 04:29 PM.
Turtle91 is offline   Reply With Quote
Old 04-09-2024, 08:34 AM   #13
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: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
Why, all of them, of course!

The devices should be maintained with soft/firm-ware updates with the latest versions. They also need to be backwards compatible to support all the older books. The opf states what version (2/3) the epub is, so it shouldn't be too hard for a reader to apply the correct function...if there are any differences.

Pseudo elements, in particular, have been around for a very long time. A device that doesn't support that css is, imho, broken...

That standard of treating unknowns as a null operation is to prevent books from crashing. If your device is old (no longer supported and/or company is out of business), or can't do color (eink), or something, then the device would ignore that css.
Sony Readers use an old RMSDK and there will not be an update. StandardEbooks eBooks won't work on a Sony Reader as they have code in the CSS that is taken as an error o the entire CSS gets ignored. I have pointed out the problem to them and they've ignored the report.
JSWolf is offline   Reply With Quote
Old 04-09-2024, 08:42 AM   #14
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by JSWolf View Post
Sony Readers use an old RMSDK and there will not be an update. StandardEbooks eBooks won't work on a Sony Reader as they have code in the CSS that is taken as an error o the entire CSS gets ignored. I have pointed out the problem to them and they've ignored the report.
Sony Readers = old/antiquated. They should just ignore the pseudo element...Thus my statement of having backup css so the book still looks acceptable. And if Sony Reader throws out the entire css then it is not standards compliant. Unfortunately, one complaint is sometimes not enough. If they refuse to maintain their product, then it is time to move on from their product. You also don't need a saddle in your horseless carriage!
Turtle91 is offline   Reply With Quote
Old 04-09-2024, 08:48 AM   #15
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: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
Sony Readers = old/antiquated. They should just ignore the pseudo element...Thus my statement of having backup css so the book still looks acceptable. And if Sony Reader throws out the entire css then it is not standards compliant. Unfortunately, one complaint is sometimes not enough. If they refuse to maintain their product, then it is time to move on from their product. You also don't need a saddle in your horseless carriage!
The main issue is they don't need this ridiculously convoluted code they feel they need to use for a simply formatted eBook. If they did it correctly then they would have no problem and would only need one ePub as it would be compatible without any problem.
JSWolf is offline   Reply With Quote
Reply

Tags
epub, kepub, kobo, kobo sage, pseudo-elements


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mangled em-dash as a CSS pseudo-element sujato Viewer 2 08-02-2022 05:47 AM
To cite ePubs: Do you recommend an ID attribute for every single element? ibu ePub 12 08-08-2013 05:03 AM
Default line-height in epubs Derek R ePub 2 02-13-2012 11:23 AM
Touch Problem with all epubs, my epubs, or my kobo? (line clipping) plague006 Kobo Reader 14 12-02-2011 11:32 PM
Command Line Batch Adding of Epubs nkormanik Calibre 6 10-19-2010 08:04 AM


All times are GMT -4. The time now is 09:32 AM.


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