08-29-2023, 08:35 AM | #31 |
Guru
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
|
Without changing the styling within the text of the book, itself, only the few items at the top of my stylesheet (down to the comment saying "This whole section is styling for specific page types of a book") will change anything. Those make changes to how some of the standard html tags (margins, paragraphs, headings, etc.) behave. Once that stylesheet is in place, you'd then have to edit the styles in the text of the book to use any particular style.
For instance, many books will use a <blockquote> tag for things like notes or letters. To change how those things look, you'd have to replace the text's surrounding <blockquote></blockquote> tags with <div class="note"></div> or <div class="letter"></div> tags. That way, the text that was initially styled with blockquote styling will be styled with whatever styling is in the stylesheet for the note or letter (in this case) custom classes. I've attached a sample of how I use the various styles. You can just add it to your library and edit it to see how the styles/tags can be used. Once you've made all the style/class changes you want, in the Calibre Editor, you can use the "Remove Unused CSS Rules" tool to remove all the unused rules in that stylesheet. EDIT: Of course, you can edit that stylesheet however you want to change how things look (or just to prune out things you don't care about). Over time, I've added all kinds of one-of-a-kind type classes that are probably useless to most people (for instance, almost everything in the "Stuff Unique to Particular Books" section near the bottom of the stylesheet). You can probably remove that section and leave a much less unwieldy (more wieldy?) stylesheet to play around with. Last edited by enuddleyarbl; 08-29-2023 at 08:44 AM. |
08-29-2023, 09:49 AM | #32 | |
Enthusiast
Posts: 32
Karma: 164
Join Date: Oct 2021
Location: Finland
Device: Kobo Libra 2
|
Quote:
I think I'm getting a bit hang of the editing but I need much more practice. One thing I'm wondering is the space between body text paragraphs. Is there a command just to get rid of them and use the the defined indent? Edit: I think I found something to add margins to the body part of the text. Last edited by Vakke; 08-29-2023 at 09:59 AM. |
|
Advert | |
|
08-29-2023, 10:03 AM | #33 | |
Resident Curmudgeon
Posts: 74,048
Karma: 129333562
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
You need to modify your eBooks based on the CSS in the eBook. Yes, you can have some of your own classes, but too many of them will not work because they won't match the CSS in the eBook. You have to do it on an eBook by eBook basis. Do not think starting with that CSS is a good idea. It's not and it's going to cause more work for you. Plus, if the eBook is ePub2, it won't work even more so. |
|
08-29-2023, 10:05 AM | #34 | |
Resident Curmudgeon
Posts: 74,048
Karma: 129333562
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Last edited by JSWolf; 08-29-2023 at 10:08 AM. |
|
08-29-2023, 10:18 AM | #35 | |
Enthusiast
Posts: 32
Karma: 164
Join Date: Oct 2021
Location: Finland
Device: Kobo Libra 2
|
Quote:
I'm using KOReader to test these ePub files, all are ePub3, the added margins are copied from native ePub file which had those settings to not have paragraphs between the body text chapters. What is your recommendation? Should the stylesheet.css be edited at all? Should I just use KOReader to handle the modification of the end product and not touch the original CSS at all? As I've stated I'm not too familiar with this part of the ePub files and your answers and suggestions don't enlighten me as they lack any advice. |
|
Advert | |
|
08-29-2023, 10:51 AM | #36 | |
Resident Curmudgeon
Posts: 74,048
Karma: 129333562
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
It's what I do. I also add in my own CSS. I don't add in all that much. When I am done editing the CSS/HTML, I once again delete any unused CSS. What you have to do with the CSS depends on the source CSS and what's done in the HTML. |
|
08-29-2023, 10:55 AM | #37 | |
Enthusiast
Posts: 32
Karma: 164
Join Date: Oct 2021
Location: Finland
Device: Kobo Libra 2
|
Quote:
Would you be able to share the CSS you use so I could test does it fit my needs? |
|
08-29-2023, 12:38 PM | #38 |
Well trained by Cats
Posts: 29,820
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
CSS use is a 'Matching game'.
class="foo" is just a link to the CSS entry .foo, where the actual styling is defined. Define once, use Many is why CSS is so great. One place to change the looks of all places class="foo" was used. One tiny change and Bold can change to Italic everyplace foo was used The space between lines of code is for US HUMANS, it does not affect the render (if done right), Look at the line numbers on the Left there can be many lines of text (really big paragraph) and only 1 number. Again, the number is for US to locate when there is an error on line 42. |
08-29-2023, 05:59 PM | #39 | |
Resident Curmudgeon
Posts: 74,048
Karma: 129333562
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
blockquote { margin-top: 1em; margin-right: 1.5em; margin-bottom: 1em; margin-left: 1.5em; } .blockquote { margin-top: 1em; margin-right: 1.5em; margin-bottom: 0; margin-left: 1.5em; } body { widows: 1; orphans: 1; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; text-align: justify; } img { max-height: 100%; max-width: 100%; } p { margin-top: 0; margin-bottom: 0; text-indent: 1.2em; } hr { margin-top: 0.9em; margin-right: 40%; margin-bottom: 0.9em; margin-left: 40%; border-top: 2px solid; } .cover { text-align: center; text-indent: 0; height: 100%; } h2 { text-align: center; text-indent: 0; margin-top: 0.8em; margin-bottom: 0.8em; } Last edited by JSWolf; 08-30-2023 at 04:25 AM. |
|
08-29-2023, 10:49 PM | #40 | |
Bibliophagist
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Then we have the ebooks that use p and p + p to handle the same situation and the ones that go in for multiple styles for each paragraph, the ones that wrap multiple divs with styles around everything to really make use of the cascading in cascading style sheets. What this means is that you must inspect the CSS with the mark 1 eyeball to understand what it is doing and then modify it to what you need. |
|
08-30-2023, 10:52 AM | #41 |
Well trained by Cats
Posts: 29,820
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Those examples scream BPH stylesheet
as fmtx1 is Front matter alternate body style 1 That was the way the book I mentioned earlier should have been coded by the contractor. Every part (area) of a book has an industry name. Code Pros know them all, en2, bm1 (UNIX style naming? AWK,SED,Grep, cd, mkdir ... ) not the long +ss names I see in many EPUB3 |
08-30-2023, 01:46 PM | #42 | |
Bibliophagist
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Basically, I was trying to say that you need to inspect the CSS and html files to understand what needs to be changed—it's not as easy as a simple copy/paste the stylesheet and you're done. |
|
08-30-2023, 01:49 PM | #43 | |
Resident Curmudgeon
Posts: 74,048
Karma: 129333562
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
08-30-2023, 01:51 PM | #44 |
Bibliophagist
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
08-30-2023, 02:15 PM | #45 |
Resident Curmudgeon
Posts: 74,048
Karma: 129333562
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
This is some rather poor CSS generated by the atrocious program Vellum. Try using that CSS in the first post of this thread and watch it fail. This CSS uses not much you can pre-edit. You need to do the editing by hand. That's why the CSS I add has not all that many classes.
Code:
/* * Little Shattered Dreams * Stylesheet generated by Vellum */ @font-face { font-family: Montserrat; font-weight: normal; font-style: normal; src: url(../fonts/Montserrat-Regular.ttf); } @font-face { font-family: Montserrat; font-weight: 500; font-style: normal; src: url(../fonts/Montserrat-Medium.ttf); } @font-face { font-family: Montserrat; font-weight: bold; font-style: normal; src: url(../fonts/Montserrat-Bold.ttf); } p { margin-bottom: 0; text-indent: 0; line-height: 1.4; margin-top: 0; text-align: justify; } p.subsq { text-indent: 1.5em; } .implicit-break { margin-top: 1.4em; margin-bottom: 0; height: 0; } .element-bodymatter .text > .implicit-break { margin-bottom: 1.4em; clear: both; margin-top: 0; height: 1.4em; } .toc-item p, .heading h1 { line-height: 1.2 !important; } .toc-item { margin-bottom: 0.1em; page-break-inside: avoid; } div.alignment-block.inset-block { margin-right: 1.5em; margin-left: 1.5em; } ul { padding-left: 3em; padding-right: 1.5em; margin-top: 1.4em; margin-bottom: 1.4em; clear: left; } p, li { hyphens: auto; adobe-hyphenate: auto; -webkit-hyphens: auto; -webkit-hyphenate-limit-lines: 2; -webkit-hyphenate-limit-after: 4; -webkit-hyphenate-limit-before: 4; } body { font-family: Palatino, serif; font-weight: normal; font-style: normal; } h1, h2 { margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; page-break-inside: avoid; font-kerning: auto; } @page { margin-left: 24px; margin-right: 24px; } a, a * { color: rgb(36, 39, 116); } a, span.underline { text-decoration: underline; } li { line-height: 1.4 !important; text-align: left; } .implicit-break { page-break-inside: avoid; } .alignment-block { clear: both; } .element-type-epigraph.element-without-heading { margin-top: 10em; } .element-type-also-by .heading .title-block, p.copyright-content { font-size: 90%; } .heading-container-single h1.element-title, .heading-alignment-fixed .element-title, p.alignment-block-content-center { text-align: center; } p.also-by-content { text-indent: 0; font-size: 90%; text-align: center; } p.also-by-content, p.also-by-content.alignment-block-content { margin-top: 0.5em; } .cover-image { max-width: 100%; max-height: 100%; display: block; margin-left: auto; margin-right: auto; } .toc-contents { padding-left: 5%; padding-right: 5%; } p.toc-content { text-align: left; font-size: 90%; } .toc-item.has-no-children .toc-item-title { text-indent: -1.5rem; padding-left: 1.5rem; } .toc-backmatter-group { margin-top: 0.75em; } h2.title-page-contributor-without-introduction { margin-bottom: 0.5em; } .element-type-toc .heading .title-block { font-size: 95%; } p.copyright-content { text-indent: 0; text-align: left; margin-top: 0.75em; } .element-type-copyright.element-without-heading { margin-top: 2.5em; } div.title-page { text-align: center; margin-right: 2%; margin-left: 2%; } div.title-page .title-page-title-subtitle-block { margin-left: 6%; margin-right: 6%; } div.title-page-title-subtitle-block { min-height: 140px; margin-top: 140px; margin-bottom: 2em; } h1.title-page-title, h2.title-page-contributor { font-weight: normal; text-align: center; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; line-height: 1.2 !important; } h1.title-page-title { font-size: 150%; text-transform: uppercase; } div.title-page-contributor-block { min-height: 80px; margin-bottom: 1.5em; } h2.title-page-contributor-primary, .heading-format-reduced .element-title { font-size: 120%; } .heading-container-single { text-align: center; margin-left: 6%; margin-right: 6%; letter-spacing: 0.03em; } .heading-size-full { min-height: 12em; } .heading-size-full.heading-without-image .heading-contents { padding-top: 4.5em; } .heading-size-small .heading-contents { padding-top: 2em; } .heading { margin-bottom: 2em; } .heading-alignment-fixed { margin-left: 6%; margin-right: 6%; text-align: center; } .heading-size-small .title-subtitle-block, .heading-size-small .title-subtitle-block .title-block, .heading-size-small .title-subtitle-block .element-number-block { padding-top: 0; } .heading-container-single .element-title { font-size: 130%; } .heading-format-full .element-number-block { min-height: 1.75em; } h2.title-page-contributor span.title-page-contributor-name, .element-title { text-transform: uppercase; } .element-title, h1.title-page-title { font-family: Montserrat, sans-serif; font-weight: bold; font-style: normal; } h2.title-page-contributor span.title-page-contributor-name { font-family: Montserrat, sans-serif; font-weight: 500; font-style: normal; } div.alignment-block { margin-top: 1.4em; margin-bottom: 1.4em; } p.alignment-block-content { text-indent: 0; margin-top: 0; } p.alignment-block-content-left { text-align: left; } |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Linking to CSS stylesheet | mossman26 | Sigil | 2 | 07-16-2020 02:38 PM |
pagestyle.css extra / integrated in stylesheet.css / or not at all? | chaot | Workshop | 14 | 02-24-2017 11:10 PM |
stylesheet.CSS anyone? | ProDigit | ePub | 81 | 12-26-2015 01:43 PM |
Converting cm to em in css stylesheet | roger64 | ePub | 41 | 06-13-2014 01:00 PM |
Where is the stylesheet.css? | roger64 | Sigil | 4 | 03-23-2010 02:12 PM |