![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Question on naming classes
I've seen some style sheets with classes based on usage in the book and some with classes defining the format
Other than possibly personal style, are there any recommendations, advantages, or disadvantages to the two approaches? Code:
h1.book-title { margin-top: 10%; page-break-after: avoid; text-align: center; margin-bottom: 2em; } h2.book-subtitle { page-break-after: avoid; text-align: center; margin-bottom: 1em; } h2.book-author { page-break-after: avoid; text-align: center; margin-bottom: 1em; } p.title-page { text-align: center; } p.publisher-logo { margin-top: 3em; text-align: center; margin-bottom: 3em; } Code:
.nospaceafter { margin-bottom: 0; } .extraspacebefore { margin-top: 2em; } .small { font-size: 75%; } .big { font-size: 150%; line-height: 150%; } .verybig { font-size: 200%; line-height: 200%; } .superbig { font-size: 250%; line-height: 250%; } |
![]() |
![]() |
![]() |
#2 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,288
Karma: 169098402
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Personal choice. The renderer really doesn't care what names you use for your classes.
I tend to give meaningful—to me—names to my commonly used classes and functional names to the rest. So chapternumber (fairly obvious) and glyphw33 (I have a whole series of glyphwxxy where the xxy is the percent width). |
![]() |
![]() |
![]() |
#3 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
|
I have both. But I rarely use the formatting classes and have all of that stuff within the css for the "ordinary" tags. For example, occasionally I need a noindent paragraph but for the normal case as in a paragraph after an h2 or h3 tag I have
Code:
dl + p, hr.asterism + p, header + p, p:first-child, section.endnotes ol, table + p { margin-top: 1.0em; text-indent: 0em; } For a tag that's inside another thing it's a space instead of a plus: Code:
blockquote p, div.block p { margin-top: 0.25em; text-indent: 0em; } Last edited by hobnail; 05-18-2020 at 02:19 PM. |
![]() |
![]() |
![]() |
#4 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
I reserve h1..h6 for TOC entries and calibre's "Use Major Headings" option So for a chapter number I might have <p class = "bold superbig center" ... so I can see that <p class="chapternumber" ... might be easier and more meaningful |
|
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
|
![]() |
![]() |
![]() |
#6 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
find missing classes | kcarscadden | Editor | 4 | 12-10-2019 08:16 PM |
Pseudo classes to be deleted as unused classes | Leonatus | Sigil | 2 | 09-23-2018 09:12 AM |
Pseudo classes with classes | Macsurfcat | ePub | 4 | 01-07-2016 04:00 AM |
Multiple classes compatibility | senhal | ePub | 5 | 11-23-2015 08:00 PM |
Aura HD Micro SD Card - All about Classes | xibalban | Kobo Reader | 7 | 09-18-2014 11:49 AM |