![]() |
#1 |
Age improves with wine.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 576
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
4.9 Check Book CSS warning
Since updating to 4.9, I get a warning ("You have 2 h1s defined") for CSS like this:
Code:
h1 { ... } h1.chapter { ... } Edit: Also, it turns out, for rules "h1.a" and "h1.b". Last edited by Phssthpok; 01-24-2020 at 02:03 PM. |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Same here using 4.9.1 - didn't used to do that
I know it's only a warning, but I think it's a wrong warning since I think it's allowed by the CSS gods From the 'detailed description' link Quote:
|
|
![]() |
![]() |
![]() |
#3 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,758
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Yes it's allowed to have CSS like the example. But really, it's poor code.
|
![]() |
![]() |
![]() |
#4 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
|
That "only defined once" rule seems bad to me. What I have in my standard stylesheet is like the following. All the common shared stuff in one rule and then the size stuff in separate rules. Following their rule would make maintenance a hassle since you'd have to duplicate stuff using copy and paste. As a programmer I learned that copy and paste was a bad "code smell".
Code:
h1, h2, h3, h4 { break-inside: avoid; break-after: avoid; font-weight: bold; hyphens: none; margin-bottom: 0em; margin-top: 1em; page-break-after: avoid; page-break-inside: avoid; text-align: center; text-indent: 0em; } h1 { font-size: 1.44em; } h2 { font-size: 1.3em; } h3 { font-size: 1.12em; } h4 { font-size: 1em; } |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
@JSWolf -- Why is it 'poor code'?
@hobnail -- I agree. Easier to maintain, clearer, and less redundancy |
![]() |
![]() |
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,758
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
@hobnail, when you have classes together like in your CSS, Calibre will not remove any of the unused classes.
Code:
h1 { font-size: 1.44em; font-weight: bold; hyphens: none; margin-bottom: 0; margin-top: 1em; page-break-after: avoid; page-break-inside: avoid; text-align: center; text-indent: 0; } h2 { font-size: 1.3em; font-weight: bold; hyphens: none; margin-bottom: 0; margin-top: 1em; page-break-after: avoid; page-break-inside: avoid; text-align: center; text-indent: 0; } h3 { font-size: 1.12em; font-weight: bold; hyphens: none; margin-bottom: 0; margin-top: 1em; page-break-after: avoid; page-break-inside: avoid; text-align: center; text-indent: 0; } h4 { font-size: 1em; font-weight: bold; hyphens: none; margin-bottom: 0; margin-top: 1em; page-break-after: avoid; page-break-inside: avoid; text-align: center; text-indent: 0; } |
![]() |
![]() |
![]() |
#7 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Agreed. Perhaps it was some recent addition.
In the Calibre 4.9.1 release notes it mentions: Quote:
Quote:
https://github.com/CSSLint/csslint/w...e-defined-once ... very odd. I don't agree with that at all. I can understand Check Book pointing out an (accidental) duplicate in your CSS: h1, h2, h3, h4 { } h2 { } h2 { } but pointing out ones that aren't the same? h2 h2.title h2.author No. I'll have to agree with phossler and hobnail on this one. Sometimes it's easier to have a centralized location for shared CSS, and then specific overrides in a different location. Side Note: And I would strongly recommend against adding hyphens: none though. Think big words ("Acknowledgements"), with big font, on tiny devices (cell phone). Just leave that setting up to user devices/preferences. Last edited by Tex2002ans; 01-24-2020 at 09:18 PM. |
||
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
|
|
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You will have to argue with the developers of csslint as to why they make that recommendation. But I agree that check book in general should avoid stylistic checks, and I have already turned most of them off, must have missed that one.
|
![]() |
![]() |
![]() |
#11 |
Age improves with wine.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 576
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
On the other hand, it also warns if you don't have a rule for h1, but just two rules for h1.a and h1.b. Changing them to .a and .b makes the warning go away. It seems wrong to be forced to reduce specificity like that.
|
![]() |
![]() |
![]() |
#12 |
Age improves with wine.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 576
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
|
So... is there a way to turn it off? Please?
|
![]() |
![]() |
![]() |
#13 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,062
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I am not happy with the stylistic warnings...
BUT I am really unhappy that they (and others) pop a RED Error shield, when that, IMHO, should just be the older Yellow warning (fix me if you care ![]() |
![]() |
![]() |
![]() |
#14 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#15 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Which stylistic warnings (apart from this one that I missed) give you errors rather than warnings?
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hyphens warning in "check book" | Phssthpok | Editor | 5 | 12-08-2015 04:47 AM |
Check non existent css styles | Terisa de morgan | Editor | 15 | 06-15-2014 10:24 AM |
Calibre Catalog CSS Warning | phossler | Library Management | 2 | 03-10-2014 11:08 PM |
Kindlegen warning about css | sderrick | Kindle Formats | 1 | 04-17-2012 04:24 AM |
Epub check warning, help! | Janephew91 | ePub | 3 | 10-01-2011 01:23 PM |