Quote:
Originally Posted by JSWolf
What I want to know is why are eBooks in 2023 getting away with such lousy code? This is the code (for a section break) from an eBook published in 2023 by Lttle, Brown, and Company.
Code:
<div class="ext_ch">
<div class="decoration-rw10">
<div>
<div class="pc-rw">
<img alt="image" class="orn" src="images/Art_sborn.jpg"/>
</div>
</div>
</div>
</div>
<p class="noindent">
|
Early in the days of actual CSS (i.e., not MOBI), the one class applied all the formatting to a element (margins, font, etc.).
Recently, the publishers have finally discovered that the "C" in CSS means "Cascading", and now have gone to the complete opposite, where a class does one thing (like margins), another does the font, and another does the text-align.
And, the last line is likely because they used a
p + p selector to create indented paragraphs, but then realized they had to special case after every
div, because
div + p created too many issues.
The recent one that got me was during the crossover between the early way and the current method (style inline for easier reading):
Code:
<div style="margin: 1em">
<p style="margin-top: 1em;">Stuff</p>
<p>More stuff</p>
<p style="margin-bottom: 1em;">Last of stuff</p>
</div>
The paragraphs use the old "all formatting in one place" version, but the outer div creates the block quote, so there is no need to put margins on the paragraphs themselves.