View Single Post
Old 09-12-2022, 04:04 PM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,961
Karma: 147448039
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by hobnail View Post
It's crappy when they use style= in the html. You should be able to use calibre's Convert Books and convert it to the same format, e.g. AZW3 to AZW3 and calibre will get rid of that style= crud.

In the long run I find it quicker and easier to be very heavy handed and delete all of their CSS and replace it with my simplified CSS:

Code:
body {
  font-size: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  width: auto;
}

body * {
  line-height: inherit;
}

p {
  font-size: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  text-indent: 2em;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,h2,h3,h4 {
  text-align: center;
}

.bold {
  font-weight: 900;
}

.italic {
  font-style: italic;
}

.bold_italic {
  font-weight: 900;
  font-style: italic;
}
That makes it ragged right, which I prefer. You could add a text-align:justify; to the body CSS if you like a straight right margin. For novels there's rarely any necessary formatting that this wrecks, aside from stuff that's in italics. So before I nuke the original CSS I look for all classes that specify italic and add them to my .italic class so that it says something like .italic,.calibre3 { where calibre3 was one of the book's classes for italic. Likewise for bold and bold italic. Everything is the same font size which is fine with me; I'm not after a work of art, I just want the story.


When you do this all of your books will have the same font size, line spacing, margins, etc. because it's using the ereader's built in CSS for everything that's not specified here. All of the classes in the HTML are ignored since there's nothing for them in this simplified CSS.
When you do this, you can end up with a mess because your styles are not what's needed in the eBook. You can actually make it more difficult to clean up.

For example, in most eBooks, there is no indent for <p> and by putting one in, you then sometimes have to add a text-indent: 0; for the classes that have a center and for any classes that expect there not to be an indent.

As for your simplified CSS, I've simplified it even more.
Code:
body {
  widows: 1;
  orphans: 1;
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  text-align: justify;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
h1,h2,h3,h4 {
  text-align: center;
}
.bold {
  font-weight: bold;
}
.italic {
  font-style: italic;
}
.bold_italic {
  font-weight: bold;
  font-style: italic;
}
JSWolf is offline   Reply With Quote