11-12-2020, 11:58 AM | #31 |
Bibliophagist
Posts: 36,326
Karma: 145735552
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I just checked and it worked with cm, mm, in, px, pt, pc, em, ex, ch, rem and % in calibre's editor and Sigil's preview. Basically, all the measurement units that I could remember. It seems as if 0 time anything is 0.
|
11-12-2020, 12:21 PM | #32 | |
Wizard
Posts: 1,079
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
@JSWolf --
Quote:
Admittedly there are other ways to do this, but I am finding that using a couple of the new tags makes the CSS a little more explanatory Code:
aside { text-indent: 0; width: 30%; margin: 0 0.25em 0.25em 0; float: right; padding: 0.2em 0.2em 0.2em 0.4em; border: thin black solid; background-color: #EEE; } article { text-indent: 0; margin: 0 1m 0 0.25em; padding: 0.2em 0.2em 0.6em 1em; border-top: thin black solid; border-left: thin black solid; border-bottom: medium black solid; border-right: medium black solid; background-color: #EEE; } /* -------------------------------------------------------------------------------------------------------*/ /* ----------------------------------------------------------------------------- figures and captions */ /* -------------------------------------------------------------------------------------------------------*/ /* usage <figure> <img src="pic_trulli.jpg" alt="Trulli" style="width:100%"> <figcaption>Fig.1 - Trulli, Puglia, Italy.</figcaption> </figure> */ figure { page-break-inside: avoid; width: 90%; border: thin silver solid; padding: 0.5em; text-align: center; margin: 1em 5% 0 5%; } figure img { width: 90%; } figure p { text-align: left; font-style: normal; font-size: smaller; text-indent: 0; margin-top: 0.5em; margin-bottom: 0; } figcaption { text-align: left; font-style: italic; font-size: 0.9em; text-indent: 0; margin: 0 0 0 1em; } |
|
Advert | |
|
11-12-2020, 01:15 PM | #33 |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
That's one of the main reasons for tags like those, semantics. They also help software that analyzes/parses html for rss feeds, databases, and other things.
Last edited by hobnail; 11-12-2020 at 01:20 PM. |
11-12-2020, 02:16 PM | #34 | |
Guru
Posts: 944
Karma: 1183425
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
Look at the screenshot. I have drop caps, indentation, ruler, headers, and just a single class for an specific case. Last edited by thiago.eec; 11-12-2020 at 02:19 PM. |
|
11-12-2020, 02:20 PM | #35 | |
Resident Curmudgeon
Posts: 74,488
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
You have to blame the companies who use RMSDK but have not kept it updated for your code failure. |
|
Advert | |
|
11-12-2020, 03:04 PM | #36 | |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Quote:
Okay, never mind. I was thinking that I had a problem with using "em" after 0 at some time in the past, but it doesn't seem like it would make any difference, since the default for all rules is zero, I believe (that is, when any rule doesn't exist for any class in the CSS file, Calibre and eReaders will assume the value is zero). Any tests that you performed were meaningless, due to the zero default for all rules. The only way to test this is to do a Check Book to see if Calibre finds an error when adding "em" after a zero. And, by the way, using 0em for any rule has nothing to do with multiplying 0 by anything, so I have no idea why you would mention that, since it wouldn't apply in this discussion. |
|
11-12-2020, 03:08 PM | #37 | |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Quote:
margin: 0 1m 0 0.25em; Should be: margin: 0 1em 0 0.25em; |
|
11-12-2020, 03:14 PM | #38 | |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Quote:
Example of a class that would result in an error, per Check Book: .image { height: 300; width: 400; } |
|
11-12-2020, 03:37 PM | #39 | |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Quote:
|
|
11-12-2020, 03:48 PM | #40 | ||
Guru
Posts: 944
Karma: 1183425
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
Quote:
|
||
11-12-2020, 04:06 PM | #41 | |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Quote:
I got this idea of using a span from Turtle91 or DNSB. If the chapter title is a single line, just the number, or just the title, it looks like this Code:
<h2 title="Chapter One">One</h2> Code:
<h([\d])>(.*)</h[\d]> Code:
<h\1 title="Chapter \2">\2</h\1> If there's a chapter number and a chapter title then it's: Code:
<h2 title="Chapter Three — A proposed expedition">Three <span>A proposed expedition</span></h2> Code:
<h([\d])>(.*) <span>(.*)</span></h[\d]> Code:
<h\1 title="Chapter \2 — \3">\2 <span>\3</span></h\1> 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; } h2 span, h3 span { display: block; font-size: larger; font-style: italic; /* overrides small-caps in 2nd .css file */ font-variant: normal; font-weight: bold; margin-top: 1.25em; } Code:
h1, h2, h3, h4 { font-variant: small-caps; font-weight: normal; margin-bottom: 2em; } The display:block is the trick that puts it on a separate line. Last edited by hobnail; 11-12-2020 at 04:11 PM. |
|
11-12-2020, 04:07 PM | #42 | ||
Guru
Posts: 944
Karma: 1183425
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
Quote:
Looks like a paradox to me... Or maybe some difficult to admit you were wrong. P.S.: CSS properties do not default to zero. They default to their initial value, which varies according to the property. See: https://www.w3.org/TR/css-cascade-4/#defaulting |
||
11-12-2020, 04:18 PM | #43 |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Addendum to my long-winded response above. On an entirely personal preference I think that using the text word for a chapter number is more "friendly" or something compared to using the digit; in other words One is better than 1. Using One also works better when axing the word Chapter. Sigil has a chapter title plugin that does this for me.
And back when I was a worker bee in IT I had a more experienced coworker repeat the saying that numbers (digits; data type integer) should only be used in software when they're being used for arithmetic. In databases you'd often see the primary key being digits when better would have been some random string, e.g. a UUID. Last edited by hobnail; 11-12-2020 at 04:22 PM. |
11-12-2020, 04:56 PM | #44 | |
Book E d i t o r
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
Quote:
When I referred to "default," I meant, for example, if the rule "text-indent: 0;" is not included in a class, then the default for the text-indent for that class is zero. It's the same with margins and many other rules, when they aren't included in a class. Does that make more sense to you now? |
|
11-12-2020, 05:07 PM | #45 |
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
But as thiago.eec pointed out they're often inheriting a value from somewhere above. Ereaders and ereader software typically have some built in css that you may not be aware of; for example, a space between paragraphs (margin-top perhaps). So just deleting the css that you think is unneeded may not work; if you want it to be zero you may need to set it to zero.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
css question | ralphiedee | Sigil | 74 | 12-23-2012 06:29 AM |
CSS Question | jackibar | Sigil | 24 | 03-01-2012 09:12 AM |
CSS question | crutledge | Workshop | 17 | 12-17-2011 07:52 AM |
CSS Question | AppleTard | Calibre | 1 | 06-12-2011 12:07 AM |
Question for the CSS experts | crutledge | Sigil | 8 | 06-10-2011 04:13 PM |