View Single Post
Old 05-29-2015, 10:03 PM   #13
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Turtle91 View Post
I see. Thanks.

I tend to use classes only when something is different from the default styling.
For example, I style the default <p> how I want it to appear 98% of the time, then put the <p class="xxx"> for the few that do something different.
Of course.
My example was a cover, it's for one page with a specific image of unusual ratio.



Quote:
Originally Posted by Turtle91 View Post
I would use <h1> for the title for hierarchy (sorry Jellby ) so the auto TOC will pick it up, then I would have just used a <div> on the second page. In your example the title would be listed twice, and the author would be listed as a chapter in the auto TOC.
In the generated TOC, the titles are duplicated, but the links are different. The H3s aren't included at all, as I did it here.
So I just rename the first link in the TOC as "Cover".
Slightly simpler than adding a new entry from scratch.



Quote:
Originally Posted by Turtle91 View Post
I just thought it was a strange way to get spacing after a header - and I've seen several books that do stuff like that - and wondered if it was done for some device/publisher compliance.
I do it on the title page, one-off. If it's a kind of heading used throughout, like a chapter or subsection, then I use margins.



Quote:
It drives me nuts when I see stuff like:

<p class="normalparagraph"><span><span class="x"><span class="y"><small><strong><span style="font-weight:normal"><span style="font-size:100%"><span style="font-family:"Times New Roman", Time, serif">&nbsp;</span></span></span></strong></small></span></span></span></p>

See: "Aspose.Words"
This converts Word to epub. Every single line of text has a bunch of nested styles, almost all duplicated.
No CSS at all.

example:

<p style="font-size:12pt; line-height:normal; margin-bottom:0pt"><span style="font-family:'Times New Roman', serif; font-size:12pt">&nbsp;</span></p>

Strip it out and add a minimal CSS file and the book is reduced by 2/3 in size. And it's possible to read the code and deal with it sensibly.

But if you first put it through Calibre, it creates a million styles like your example and the code is even more incomprehensible.

When I get obsessive and want to clean up a file full of calibreXXX codes, I start tracking the style usage and often find a bunch of them are used once or a few times to style nbsp, and so can be deleted.


Anyway, how you code, is a matter of style, as long as it works, of course.

Styling each and every paragraph from scratch is one extreme. Doing absolutely everything by separate CSS files is another.
I lean more to CSS, but occasionally the formatting is specific to that text/page and I fnd it simpler if it's right there where the text is, so I can edit it in one window.

If later I find myself reusing a technique I might revisit it and generalise it to a CSS style.

Last edited by AlanHK; 05-29-2015 at 11:51 PM.
AlanHK is offline   Reply With Quote