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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-11-2026, 06:45 AM   #1
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2023
Device: Kindle ColorSoft
Using :has() pseudo-class ?

Hello, I have an issue trying to use :has() pseudo-class selectors in e-books.

Example:
.ChapterS:has(+.SubChapter) {
margin-bottom: 1em !important;
color: red !important;
}


The Kindle conversion logs show this:

Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
Inserting metadata into book...
Flattening CSS and remapping font sizes...
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .ChapterLocation)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .SubChapter)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .ChapterLocation)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .SubChapter)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown)


Calibre supports them correctly for the display in the editor (text displays correctly, tested with some color tags) but the conversion doesn't.
Is this an issue in Calibre or in KFX Output ? (unclear to me)
Zillion_ is offline   Reply With Quote
Old 10-11-2026, 08:28 AM   #2
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: 85,317
Karma: 154365101
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 Zillion_ View Post
Hello, I have an issue trying to use :has() pseudo-class selectors in e-books.

Example:
.ChapterS:has(+.SubChapter) {
margin-bottom: 1em !important;
color: red !important;
}


The Kindle conversion logs show this:

Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
Inserting metadata into book...
Flattening CSS and remapping font sizes...
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .ChapterLocation)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .SubChapter)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .ChapterLocation)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ .SubChapter)' (Expected an argument, got <DELIM '.' at 16>)
Ignoring CSS rule with invalid selector: '.ChapterS:has(+ blockquote)' (The pseudo-class :has() is unknown)


Calibre supports them correctly for the display in the editor (text displays correctly, tested with some color tags) but the conversion doesn't.
Is this an issue in Calibre or in KFX Output ? (unclear to me)
Try converting to KF8 and see if the pseudo class still works. It could be an issue KFX not supporting it.
JSWolf is offline   Reply With Quote
Advert
Old 10-12-2026, 12:06 AM   #3
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: 55,082
Karma: 182340534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Zillion_ View Post
Hello, I have an issue trying to use :has() pseudo-class selectors in e-books.
....
Calibre supports them correctly for the display in the editor (text displays correctly, tested with some color tags) but the conversion doesn't.
Is this an issue in Calibre or in KFX Output ? (unclear to me)
For KFX supported attributes and tags, have you looked at the Attributes and Tags Supported by Enhanced Typesetting page in the appendices to the Amazon's Kindle Publishing Guidelines?

You can also check the HTML and CSS Tags Supported in Kindle Format 8 in the same document.

As far as I am aware, ePub3 added support for :has in version 3.3 when CSS support was updated to Selectors Level 4. IRL, that translates to most support other than Apple's Books and Kobo's apps and proprietary renderer is poor to non-existent.

calibre's ebook viewer is Chromium browser based and a very poor choice for testing what output will look like on an ereader. For the most part, I find using a couple of apps and physical devices is the best way to test before publishing.

Last edited by DNSB; 10-12-2026 at 12:27 AM.
DNSB is offline   Reply With Quote
Old 10-12-2026, 12:12 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,546
Karma: 29634066
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Conversion does not support has() because the underlying css library does not support it
kovidgoyal is offline   Reply With Quote
Old 10-12-2026, 12:48 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,546
Karma: 29634066
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...d273e06a3132b2
kovidgoyal is offline   Reply With Quote
Advert
Old 10-12-2026, 06:38 AM   #6
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2023
Device: Kindle ColorSoft
thanks Kovid!
Zillion_ is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pseudo-elements Dani82 KOReader 2 07-18-2023 03:17 AM
descendant combinator w/ pseudo class broken? rjwse@aol.com Calibre 1 10-21-2019 11:53 PM
Aura H2O MicroSDHC card class 4 or class 10? chipro12 Kobo Reader 5 07-04-2015 02:24 AM
PRS-650 SD Card Importance? SDHC, SDHC Class 4, Class 10 etc is it important Renji Sony Reader 11 12-03-2011 12:30 PM
Pseudo-crash w/V 6.39 petercreasey Calibre 12 02-11-2010 05:59 AM


All times are GMT -4. The time now is 09:16 PM.


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