07-17-2022, 03:20 PM | #1 |
Guru
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
What's Going on with this Class/Style?
Can someone explain the point of the following class/style?
Code:
.element-container-single.element-type-also-by .heading .title-subtitle-block, .element-container-single.element-type-also-by .heading .title-subtitle-block .title-block, .element-container-single.element-type-also-by .heading .title-subtitle-block .element-number-block, .element-container-single.element-type-about-author .heading .title-subtitle-block, .element-container-single.element-type-about-author .heading .title-subtitle-block .title-block, .element-container-single.element-type-about-author .heading .title-subtitle-block .element-number-block { padding-top: 0; } In the current book I'm trying to reformat, I looks at a file that contains a couple of lines of simple text and the underlying formatting for it is a full page of wall-o-text. I can't figure out what the page is doing because all the formatting codes burn my eyes out and short-circuit my brain. |
07-17-2022, 03:53 PM | #2 |
A Hairy Wizard
Posts: 3,094
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
|
Most often those ridiculous class names are created by some automated software that is trying to interpret what the author wants...this is also mostly caused because authors don't properly set up their styles (and use them consistently) in said software.
You are perfectly correct to use human readable names so that you understand what it is doing. When I clean up some books that have been transformed by Calibre, the hardest part is figuring out what the difference is between Calibre3 and Calibre_3...lol Definitely not bashing Calibre software, I understand why it has to do that and it does a great job - it's just very difficult trying to edit a book when you can't easily tell what the class is doing when reading the HTML. |
Advert | |
|
07-17-2022, 04:25 PM | #3 | |
Bibliophagist
Posts: 35,401
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Yes, Vellum stylesheets are not meant to be humanly readable. Last edited by DNSB; 07-17-2022 at 04:30 PM. Reason: Added nasty about Vellum stylesheets |
|
07-18-2022, 04:27 AM | #4 |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Vellum is GARBAGE at best.
|
07-18-2022, 10:10 AM | #5 |
the rook, bossing Never.
Posts: 11,156
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Calibre Editor though has a Rename class feature useful if you want meaningful names.
|
Advert | |
|
07-18-2022, 10:38 AM | #6 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
And so does Sigil. That said, notice the space in many of the selector list entries. There are descendant css classes in play. So you might want to split that selector on the commas before renaming to be very safe.
|
07-18-2022, 10:58 AM | #7 |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
What I tend to do with multiple CSS names with the same code is rename them to the same class name. It makes the HTML?CSS easier to deal with.
|
07-18-2022, 11:13 AM | #8 |
Guru
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
I wasn't aware of Calibre Editor's rename feature. That sounds convenient. I'll look into that.
|
07-18-2022, 06:02 PM | #9 | |
the rook, bossing Never.
Posts: 11,156
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
It will even remove redundant style files. Then you can in any HTML file, find the 2nd etc names and use the rename feature globally. |
|
07-18-2022, 06:12 PM | #10 |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Vellum is one of the worst offenders of crappy CSS where you may need to rename and get rid of the excess sludge.
|
07-18-2022, 06:45 PM | #11 |
Guru
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
I had used the Calibre Editor's Remove Unused CSS tool and that cut the stylesheet down from about 1500 to 600 lines. I then went through the files and changed the classes bit by bit. At the end, I was back down to my standard set of classes (and it looks fine). At that point, I had to wonder if I would have just been better off mass deleting all of their classes and just applying my own to the bits and pieces that needed additional formatting. I suppose another alternative would be to set up a new, additional stylesheet and swapping the links to their stylesheet to mine. That way, I could have something to compare to or go back to if I had to.
|
07-20-2022, 09:42 PM | #12 | |
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
It works by:
* * * Great news though! More advanced cleanup tools WILL BE coming to Sigil soon! After describing my methods in that late-2021 topic, for months, the stuff was nibbling away at me, so I consolidated my decade of ebook-conversion knowledge and proposed ideas to KevinH. Here's 2 of the advanced tools that are being worked on:
See this post where I describe some of the use-cases in extreme detail: CSSToolbox This will allow you to find/detect—and merge—exact/similar classes together: Spoiler:
Right now, "Remove Unused CSS" only works on CSS that isn't used at all. This will allow you to take the next step:
Side Note: And the Calibre EPUB->EPUB method changes almost everything into "calibre###" classes. This method will keep names in tact. * * * Advanced Find/Replace (List-based) This will allow you to:
Spoiler:
This will allow you to visually see all before/after changes in a single menu, and you could selectively apply. * * * These tools will greatly speed up all sorts of workflows. And who knows what other tricks and methods we'll come up with after people begin messing around with it. Last edited by Tex2002ans; 07-20-2022 at 09:53 PM. |
|
07-21-2022, 03:51 AM | #13 | |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
07-21-2022, 09:31 AM | #14 | |
A Hairy Wizard
Posts: 3,094
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:
I honestly didn't read all of Tex' post (only so many hours in the day... ), but I definitely know of circumstances where you would want a font-size of 1.1em. This definitely would not be for the whole book, only specific sections. For example, if the book font is generally a sans-serif and I want a section to be serif, then I'll give the serif section a slightly larger font-size. The standard serif fonts I work with tend to be slightly smaller than the sans- so I need to bump the size up slightly to even up the look. Conversely, I will usually reduce the font-size whenever I use <strong> {font-weight:bold; font-size:.9em} (or maybe .95em) to make it fit a little better with the rest of the words. And yes, Jon, I do use <strong> especially in things like a glossary...the term is strong and the definition is normal...I usually put it in a hanging indent. Code:
<div class="hang"> <p><strong>term -</strong> term details</p> <p><strong>term -</strong> term details</p> <p><strong>term -</strong> term details</p> </div> |
|
07-21-2022, 12:56 PM | #15 | |||
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Code:
font-size: 16px; Code:
font-size: 17px; - - - - - Side Note: If you wanted advanced examples + a breakdown of every category under the sun, see Post #92+ in that "Adding limited features" thread. I described every case, using real-life code... and I even color-coded it for you. Straight out of Word/InDesign, you typically get messes like this: Spoiler:
You think indents are important? Okay, then don't merge the classes together. You think that difference is irrelevant? Merge them. The great thing about this newer method is you can easily:
Quote:
Quote:
Want to read more details? Great! Go read the thread above. I explain it all! If I changed the example, then Jon would've inevitably swooped in to rant about: "Don't you know how bad pixels are for font size?" - - - Anyway, all you need to know is: Soon, there will be yet another tool in the toolbelt!
Me+KevinH are both figuring out a way to handle this better than ever before. But, for now, you'll have to keep doing the ol', crappy, manual way. Last edited by Tex2002ans; 07-21-2022 at 02:21 PM. |
|||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need help with style settings and screen dpi to match my kindle reader style | Gaqs | KOReader | 3 | 05-13-2022 06:02 AM |
Forma Should I get the origami-style case or the simple one-fold-style for my Forma? | droopy | Kobo Reader | 8 | 08-25-2019 05:15 PM |
Inline STYLE attribute not converted to class | sherman | Conversion | 4 | 05-05-2016 08:11 AM |
Aura H2O MicroSDHC card class 4 or class 10? | chipro12 | Kobo Reader | 5 | 07-04-2015 02:24 AM |
Feature request: new CSS class from computed style | kat7 | Sigil | 23 | 01-02-2015 01:30 PM |