Quote:
Originally Posted by AS7
... Could you clarify what <body class=“calibre"> is supposed to do then? It seems to be there by default...
What are some of those "things" you're referring to that I would want in a <body class>?
Is it a way to apply modifications in bulk? Can I just have <p class> instead? Or does it replace <p class>?
I've googled <body class> a bit, but remain confused for now...
|
<body class="calibre"> is a default that Calibre uses on its conversions. I assume it is there to make a standard canvas that it can apply the other css elements it converts. I would think it would be very difficult to create an automated software that responded correctly to all the different documents dynamically...without making mistakes...without having a default canvas. I am sure there are people here (like BetterRed or Kovid himself) that know better the inner workings of Calibre's conversion requirements. They may be able to better answer 'why' it has that default.
You could use a body class if you wanted to apply some style to the document itself...instead of the elements ON the document; such as a background color, or background image. I shudder to think of doing that to an ebook on general principle, but I admit to having done it where I had to force a dark background with light colored font. That was the only way I could accommodate different font colors which the author (effectively) used to help tell the story.
98.7% of statistics are made up on the spot...

but it also happens to indicate the portion of paragraphs in a standard ebook that are your normal everyday paragraph containing text. I use a plain <p> to indicate those paragraphs and style them using: p {yadda yadda}
I use classes to designate
special styling only. That tends to get rid of a lot of code bloat...as well as make it easier when editing.
Code:
<body>
<h3>Chapter Title</h3>
<p class="first">This is the first paragraph in the chapter with a
drop-cap or other special styling.</p>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with normal text.</p>
<p class="red">This is a normal paragraph with red text.</p>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with normal text.</p>
<hr class="scenebreak"/>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with an <span class="u">underlined</span> word.</p>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with normal text.</p>
<p>This is a normal paragraph with normal text.</p>
</body>
Doing it that way makes it easier (and more logical) to set up your style sheet. Any changes you want to make to the style of your book are made just once, and it gets applied to the whole book (eg. first paragraph styling).
Code:
body {yadda yadda}
p {basic styling for a basic paragraph}
p.red {color:red}
p.first {styling for the first paragraph in the chapter}
span.u {text-decoration:underline}
hr {margin:1em 0; border:none; text-align:center; font-size:.7em}
hr.scenebreak:after {content:'◆◆◆◆◆'}