|
|
#1 |
|
Connoisseur
![]() Posts: 64
Karma: 10
Join Date: Mar 2019
Device: Kindle 3 Paperwhite
|
Automatic fix of an ID name causes loss of CSS styling
When Calibre Editor's Check Book function reports an invalid ID, the automatic correction "Replace this id with a randomly generated valid id" (or "Try to automatically fix all fixable errors") changes the id attribute in the XHTML file, but does not update CSS selector referring to the ID.
As a result, the CSS rule no longer matches the element and its formatting is silently lost. example: xhtml: Code:
<p id="_example">This paragraph is formatted by CSS.</p> Code:
#_example {
text-align: right;
font-weight: bold;
}
xhtml: Code:
<p id="uiIKYKleNpAABQhFyzTceGC">This paragraph is formatted by CSS.</p> (without change) expected behaviour: css: Code:
#uiIKYKleNpAABQhFyzTceGC {
text-align: right;
font-weight: bold;
}
(This appears to be a different issue from the historical bug concerning ID references in the OPF spine (Calibre bug 1479462).) |
|
|
|
|
|
#2 |
|
Connoisseur
![]() Posts: 64
Karma: 10
Join Date: Mar 2019
Device: Kindle 3 Paperwhite
|
Potential issue: A straightforward modification of the selector—based on changing a specific ID—could cause unwanted formatting change in (hypothetical) other XHTML document using the same CSS and containing an (hypothetical) ID of the same name...
Therefore, the solution would have to be more complex. And probably include analyzing occurrences of IDs with the same name and, if necessary, generating new CSS definitions (rather than modifying the selector in the existing one). |
|
|
|
| Advert | |
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ordering css styling within a given class | ElMiko | ePub | 5 | 08-18-2025 10:18 PM |
| Image styling css... what do all these properties do? | ElMiko | Sigil | 107 | 06-30-2025 05:16 PM |
| CSS Styling based on class/existing styling | 1ily | Calibre | 8 | 03-17-2025 06:37 AM |
| Incorrect styling with specific CSS | quiris | Marvin | 9 | 07-04-2016 01:04 PM |
| CSS Styling not showing up in digital editions | sjkramer | Sigil | 9 | 01-30-2010 10:46 AM |