|
|
#1 |
|
Enthusiast
![]() Posts: 29
Karma: 10
Join Date: May 2024
Device: Clara 2E
|
Calibre not using my indent command
Hello everybody,
I use this css styling for my epub conversions: p { p:first-of-type { text-indent: 0 !important; } p { margin: 0 !important; padding: 0; widows: 1; orphans: 1; text-indent: 1em !important; } Unfortunately calibre indents with more than 1em for the other paragraphs except the first one. How can I combine the two p commands in one, so that the text indent will be 1em? My goal is that the first indent after chapter or space break is 0 and the normal indent after paragraph should be 1em. Thank you in advance |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,703
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
|
|
|
|
|
|
#3 |
|
Enthusiast
![]() Posts: 29
Karma: 10
Join Date: May 2024
Device: Clara 2E
|
The thing is I have tinkered around with the curly brackets and it either indented after every paragraph with 1em even after chapter or the first one was not indented but every other had like 2.5em.
Is it ok to have two p commands or does just the first one count and the second one will be of no use to calibre? Also tried this with no luck: p { p:first-of-type { text-indent: 0 !important;} margin: 0 !important; padding: 0; widows: 1; orphans: 1; text-indent: 1em !important; } |
|
|
|
|
|
#4 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,703
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
You can't nest CSS rules as far as I am aware. So your double sets of curly brackets won't work.
Sometimes it is easier to just use basic coding, so I wouldn't be trying to combine rules https://www.w3schools.com/css/css_combinators.asp I would use two separate rules... For all your standard paragraphs, use this for your 1em indent p { display: block; margin-top: 0; margin-bottom: 0; text-indent: 1em; } Then for your first para after scene break, use the following. It will give you spacing above for the scene break. And yes, you will have to modify all the scene break p tags to include the class. <p class="scene">Blah blah.</p> .scene { padding-bottom: 0; padding-top: 2em; text-indent: 0; } If you want to use pseudo elements, they will need to be two separate rules anyway, and not all ereader software will understand it. https://www.w3schools.com/css/css_pseudo_elements.asp |
|
|
|
|
|
#5 |
|
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 118402
Join Date: Jul 2009
Device: Cybook Gen3
|
For me the use of p + p would be the easier solution
Code:
p {
text-indent: 0 !important;
}
p + p {
margin: 0 !important;
padding: 0;
widows: 1;
orphans: 1;
text-indent: 1em !important;
}
|
|
|
|
|
|
#6 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 81,050
Karma: 150250725
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You don't need !important. Nothing is going to override your p that you cannot fix.
|
|
|
|
|
|
#7 |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,173
Karma: 111120239
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
The previous solution is more general and reliable. Explicit class where you want a specific indent is better and a search should find the things that need the new class.
Last edited by Quoth; Today at 07:06 AM. |
|
|
|
|
|
#8 |
|
Enthusiast
![]() Posts: 29
Karma: 10
Join Date: May 2024
Device: Clara 2E
|
Thank you all for the great help.
This solution is working like a charm: p { text-indent: 0 !important; } p + p { margin: 0 !important; padding: 0; widows: 1; orphans: 1; text-indent: 1em !important; } I have tested it with 10 ebooks which were poorly made and it still did a great job. Fantastic. There is only one thing left now, sometimes the chapter title is just above the text without a space line. Is there something to fix that too? I know some ebooks use h3, some h1 for chapter headings. In order the get them all there must be something like: h1, h2, h3 { margin-bottom: 1.5em; } but that is not working sadly. |
|
|
|
|
|
#9 | |
|
Enthusiast
![]() Posts: 29
Karma: 10
Join Date: May 2024
Device: Clara 2E
|
Quote:
p { text-indent: 0 !important; } p + p { margin: 0 !important; padding: 0; widows: 1; orphans: 1; text-indent: 1em !important; } but I am okay with a rate of 90%. Right now I have tested 10 ebooks and they all worked with this method without the scene break p tags. I was wondering if your solution with margin-top and margin-bottom values could be transferred to the space beneath headings to make it equally for every ebook. |
|
|
|
|
|
|
#10 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 81,050
Karma: 150250725
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
What you want is this... Code:
p {
margin-top: 0;
margin-bottom: 0;
widows: 1;
orphans: 1;
text-indent: 1.2em;
}
.noindent {
text-indent: 0;
}
Another thing I do is... Code:
h2 {
text-align: center;
text-indent: 0;
margin-top: 0.8em;
margin-bottom: 0.8em;
}
hr {
margin-top: 0.9em;
margin-right: 40%;
margin-bottom: 0.9em;
margin-left: 40%;
border-top: 2px solid;
}
h2 + p, hr + p, .noindent {
text-indent: 0;
}
Last edited by JSWolf; Today at 09:27 AM. |
|
|
|
|
|
|
#11 | |
|
Enthusiast
![]() Posts: 29
Karma: 10
Join Date: May 2024
Device: Clara 2E
|
Quote:
Regarding the blockquotes: I have read hundreds of ebooks in the last 10 years and only a couple of them had blockquotes. This is not a very common thing or the creators of ebooks don't use it often. I am still trying to figure out how the h2 and hr css command work properly, because right now there is no change to be seen. And is there a downside in using the !important command? |
|
|
|
|
|
|
#12 | |||
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,703
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
Quote:
Quote:
Another failed edit. Your stylesheet is probably not linked. |
|||
|
|
|
|
|
#13 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 81,050
Karma: 150250725
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
You use the <h2> like this... Code:
<h2>Chapter 1</h2> <p>First paragraph.</p> [code]<p>This is the last paragraph before the section break</p> <hr/> <p>This is the start of the next section.</p>[code] The <p> after the </h2> and <hr/> will not be indented. It's that simple. You can edit <hr> and <h2> how you want. Last edited by JSWolf; Today at 03:06 PM. |
|
|
|
|
|
|
#14 | |
|
Enthusiast
![]() Posts: 29
Karma: 10
Join Date: May 2024
Device: Clara 2E
|
Quote:
I have found the culprit for my ebook which refused to put some space after a chapter heading. This is the code: class="calibre_3"><a href="index_split_002.html#filepos1662"><span class="calibre2">CHAP*TER ONE</span></a> Is this normal for a chapter beginning? The creator of this ebook included hyperlinks for every heading which brings you back to the beginning of the ebook when clicked. Never saw this before. But I handled it the oldschool way: search and replace the beginning of the chapter with the command <br> |
|
|
|
|
|
|
#15 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,703
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Oh, right. You are trying to make all these edits using these rules in conversion dialogue.
Don't do that. Open your epub in the Editor and make your edits there. Teach yourself how epub coding works, rather than that hit-n-miss approach in conversion. If you don't, you are always going to run into problems and unable to figure out why. Even your comment "I don't have a stylesheet" is a major red flag issue. Of course you do, but you don't know what it is or where it is. So how can you possibly fix any coding issues? So, go ahead, open the epub in the Editor and look at how an epub is built. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Command line, Adding books also picks up metadata not in command used | droodled | Library Management | 2 | 11-26-2025 10:30 AM |
| Is there a way to execute a non-root command without access to command line | Galunid | Kindle Developer's Corner | 4 | 05-15-2018 08:50 PM |
| Aldiko & Calibre Indent Woe. | Themus | Calibre | 1 | 05-19-2012 05:37 PM |
| Calibre Indent Issue When Removing Blank Lines (Converting From HTML to MOBI or EPUB) | David Derrico | Calibre | 5 | 08-04-2010 01:13 AM |
| calibre command line utilities and calibre defaults | astrodad | Calibre | 2 | 08-07-2008 04:27 PM |