Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 05-17-2020, 09:06 PM   #1
phossler
Guru
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 887
Karma: 295056
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%;
}
phossler is offline   Reply With Quote
Old 05-18-2020, 12:11 AM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 7,430
Karma: 32971131
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Forma, Clara HD, Nexus 7 HD, iPad Pro, 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).
DNSB is offline   Reply With Quote
Old 05-18-2020, 01:42 AM   #3
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 353
Karma: 2114530
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;
}
The plus means the css is for the tag (p) after that plus and in the html that tag (p) immediately follows what is in front of the plus (header, table, etc.). My h2 and h3 tags are inside a header group/block which is why you don't see them in this css.

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;
}
My goal is to use as few class="whatever" tags as possible.

Last edited by hobnail; 05-18-2020 at 02:19 PM.
hobnail is offline   Reply With Quote
Old 05-18-2020, 10:42 AM   #4
phossler
Guru
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 887
Karma: 295056
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by DNSB View Post
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).
I've been pretty much using class names (.noindent) describing how they look, and not so much what they're used for (.chapternumber)

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
phossler is offline   Reply With Quote
Old 05-18-2020, 10:44 AM   #5
phossler
Guru
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 887
Karma: 295056
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by hobnail View Post
My goal is to use as few class="whatever" tags as possible.

Ditto

Cleaning epubs for my Kindle, I see <p class="indent"> ... 1000's of times. Just easier to define <p> the way I want
phossler is offline   Reply With Quote
Old 05-18-2020, 02:21 PM   #6
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 353
Karma: 2114530
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by phossler View Post
Ditto

Cleaning epubs for my Kindle, I see <p class="indent"> ... 1000's of times. Just easier to define <p> the way I want

Exactly. I hate that. They're probably the result of some software that produces the html.
hobnail is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 01:47 AM.


MobileRead.com is a privately owned, operated and funded community.