View Single Post
Old 02-08-2024, 05:22 AM   #47
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: 80,075
Karma: 147983159
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 Turtle91 View Post
Here is an example of what I would call code bloat:
Code:
<p style="margin:0.00% 0.00%; text-indent:1.2em; line-height:110%; widows:0; orphans:0;
          font-size:1.0rem"> <span style=" font-size:1.0rem">We weren’t.</span> </p>
<p style="margin:0.00% 0.00%; text-indent:1.2em; line-height:110%; widows:0; orphans:0;
          font-size:1.0rem"> <span style=" font-size:1.0rem">We’d planned the general
          strategy weeks ago, and confirmed it days before.</span> </p>
Excerpted from On the Shoulders of Titans by Andrew Rowe, Published in 2018. I added line-breaks so you could easily see it here.

Inline styling makes me shudder anyway, but the fact that the same styling is put on EVERY FREAKING LINE... that is totally unnecessary...and bloats the code. The same goes for putting a span, with inline styling, around every paragraph simply to tell it to use the standard font size.... which it already told it in the first set of styling!

Here is what I would reduce it to:
Code:
CSS:
p {margin:0.00% 0.00%; text-indent:1.2em; line-height:110%; widows:0; orphans:0;
   font-size:1.0rem}

HTML:
<p>We weren’t.</p>
<p>We’d planned the general strategy weeks ago, and confirmed it days before.</p>
Yes Jon, we know you don't like that styling and would change it. The point here is that it doesn't change the author's/publisher's styling at all...it just reduces code bloat.

Which is easier to read? If you needed to edit the way all your paragraphs looked you would need to change every single paragraph the way it currently stands. Reducing the code bloat and using css, as in the second example, I only need to make the change in one place and it updates the whole book.

I don't really expect the code bloat to change the file size all that much...certainly not as much as fixing the images/fonts...although I have reduced massive books by a couple of megabytes. I would rather not put ANY renderer, no matter how capable, through the constant headache of crunching through all that bloat just to determine what and how it should be displayed... my phone seems to stay cooler and the battery lasts longer. (That's my story and I'm sticking to it! )


Cleaning up the unused css styles is automagically done for me when I use the Sigil plugin cssRemoveUnusedSelectors, so I don't spend too much time and energy cleaning up that "bloat".
I've seen some eBooks with CSS yet an inline style for indent is used. I have no idea why that is.
JSWolf is offline   Reply With Quote