Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-23-2022, 02:03 PM   #1
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: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
why does every tag have a class?

Books I get from amazon, and probably elsewhere, always have a class on every p tag and even on the i tag. For the books I've uploaded here I go the opposite way and have some css for the unclassed/base tags and then have classes when I want to modify the base tag. I thought that's what the cascade in CSS was all about.

Am I missing something? Is there some good reason to put a class on every tag?
hobnail is offline   Reply With Quote
Old 03-23-2022, 02:29 PM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Yes, I also wondered why <i> and <em> tags have a class, and when checking the css, that class uses font-style: italic;. Are they aiming for double italic, with the letters almost lying down flat?
Karellen is offline   Reply With Quote
Advert
Old 03-23-2022, 03:31 PM   #3
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
I'd assume something autogenerated, especially if not human-readable. Or if they are human-readable, perhaps an attempt at higher CSS precedence to prevent device/user/etc overrides.
phillipgessert is offline   Reply With Quote
Old 03-23-2022, 03:44 PM   #4
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: 79,763
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
It's because whoever is making these eBooks is using some program to help make the eBooks. I can take these poorly made eBooks and when I'm done, the code is much cleaner and the formatting much nicer.
JSWolf is offline   Reply With Quote
Old 03-23-2022, 04:05 PM   #5
slm
Fool
slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.
 
Posts: 468
Karma: 4113712
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
John
<i> displays as font-style:italic on most browsers, but it not required to do so--see https://developer.mozilla.org/en-US/...TML/Element/i:
In earlier versions of the HTML specification, the <i> element was merely a presentational element used to display text in italics, much like the <b> element was used to display text in bold letters. This is no longer true, as these tags now define semantics rather than typographic appearance. A browser will typically still display the contents of the <i> element in italic type, but is, by definition, no longer required to do so. To display text in italic type, authors should use the CSS font-style property.
slm is offline   Reply With Quote
Advert
Old 03-23-2022, 05:01 PM   #6
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by slm View Post
To display text in italic type, authors should use the CSS font-style property.
That's an argument for styling, not an argument for a class. Whether you have <i> or <i class="foo">, you can style them equally well.

The only difference, as phillipgessert mentioned, is that the style defined for <i> could be overridden by some user/software preference, while <i class="foo"> would have higher priority and be less likely to be overridden.
Jellby is offline   Reply With Quote
Old 03-23-2022, 05:38 PM   #7
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: 79,763
Karma: 145864619
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 slm View Post
John
<i> displays as font-style:italic on most browsers, but it not required to do so--see https://developer.mozilla.org/en-US/...TML/Element/i:
In earlier versions of the HTML specification, the <i> element was merely a presentational element used to display text in italics, much like the <b> element was used to display text in bold letters. This is no longer true, as these tags now define semantics rather than typographic appearance. A browser will typically still display the contents of the <i> element in italic type, but is, by definition, no longer required to do so. To display text in italic type, authors should use the CSS font-style property.
The only way to make <i> not be italic is if I change it in CSS, Otherwise, <i> is italic. So really, using CSS to define italic is not needed. It's excess code.

<i>, <em>, <b>, <strong> all do not need a class if all you are doing is italic and/or bold. I strip useless classed from there as again, not needed. I cannot stand a <span> to italicize or bold.
JSWolf is offline   Reply With Quote
Old 03-23-2022, 05:41 PM   #8
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: 79,763
Karma: 145864619
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 Jellby View Post
That's an argument for styling, not an argument for a class. Whether you have <i> or <i class="foo">, you can style them equally well.

The only difference, as phillipgessert mentioned, is that the style defined for <i> could be overridden by some user/software preference, while <i class="foo"> would have higher priority and be less likely to be overridden.
Of course, you could define <i> in CSS for most uses of <i> and then only have a class when you want to do something different.

I prefer <p> to be mostly just <p> so I have CSS to define the most used definition of <p>. Again, I cannot stand something like <p class="indent"> when <p> would do instead.
JSWolf is offline   Reply With Quote
Old 03-23-2022, 05:50 PM   #9
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,355
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I’m not sure that using a class to avoid the device overriding the styling would be all that effective?? It seems that if the device is going to ignore the included css in favor of its own, then the device would override css classes as well. Has anyone seen this behavior in the wild where the technique actually works??
Turtle91 is online now   Reply With Quote
Old 03-23-2022, 06:11 PM   #10
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by JSWolf View Post
Of course, you could define <i> in CSS for most uses of <i> and then only have a class when you want to do something different.

I prefer <p> to be mostly just <p> so I have CSS to define the most used definition of <p>. Again, I cannot stand something like <p class="indent"> when <p> would do instead.
I am happy to read this. It is the argument I took when I first started editing ebooks a year and a bit ago, when I was still on my (persistent) learning curve.. "why do I need all this code?"

I asked a similar question in another thread of mine, why is everthing class= calibre1, calibre2, calibre3, calibre_1, calibre_2. It used to annoy me so I started to strip everything out and style the base tags in the css and only add a class when I needed something different to what the base tags were styled to.
Karellen is offline   Reply With Quote
Old 03-23-2022, 07:06 PM   #11
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
Quote:
Originally Posted by Turtle91 View Post
I’m not sure that using a class to avoid the device overriding the styling would be all that effective?? It seems that if the device is going to ignore the included css in favor of its own, then the device would override css classes as well. Has anyone seen this behavior in the wild where the technique actually works??
Yeah, I’m not sure it would be particularly reliable, was just a thought. Folks gambling that a device might override some styling on default p, but does it by playing with precedence for a lighter touch than just completely trashing a stylesheet. It’s honestly the only thing I can think of that would make an actual human define something like p.paragraph or something.

It kind of makes sense if you figure that’s how all the devices work, really. They display however they want, apart from whatever we set that they feel like honoring. If you bump something up in precedence via something like p.center, odds are it will center. Set some rule on p.center that they don’t honor, and it usually falls back to whatever the default value is. Then you just kinda draw that same thinking all the way out to p.myfavoritesettings and roll the dice. I don’t do it, I don’t like the sound of it, but I can sort of understand the thinking. It’s like excessively-defined p rules are in the first place, just with a “pretty please” on top.

Last edited by phillipgessert; 03-23-2022 at 07:28 PM.
phillipgessert is offline   Reply With Quote
Old 03-23-2022, 08:16 PM   #12
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,355
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I suppose that would work if the device just overrides the base class. I was thinking it just ignores the css sheet altogether. If .para is defined on the sheet, and the sheet is ignored, then it would ignore the .para as well. If I were a developer it seems like it would be easier to just give the user selected setting - like margin, font-size, etc. - an !important tag to override just those parts of the base tag.

Oh well. Thanks for the brain exercise!
Turtle91 is online now   Reply With Quote
Old 03-24-2022, 01:15 AM   #13
phillipgessert
Addict
phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.phillipgessert ought to be getting tired of karma fortunes by now.
 
phillipgessert's Avatar
 
Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
An original CSS contributor recently tweeted some info about the origin of !important. He said it was only added in order to force adherence to governmental regulation on font size. I always knew it was a bit naughty but it really kind of reconfigured my perspective on it at a time when I happened to be thinking about precedence more anyway, and this topic coming along was oddly relevant as well in that regard.

https://mobile.twitter.com/stevenpem...39184287870981

Bit off topic but hopefully of some interest.
phillipgessert is offline   Reply With Quote
Old 03-24-2022, 02:00 AM   #14
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: 46,263
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Personally, I've pretty much given up on having a epub look close to the same on different renderers. The final straw for me was a few years back when an acquaintance complained about how epubs were boring and all of them looked the same. Oddly, the Android program he used and regarded as "the best ebook reader program ever" was configured out of the box to disregard any publisher styles whether applied through a stylesheet or inline. If you could be bothered to dig down through multiple levels of menus, you could find the multiple checkbox options to enable using publisher CSS and show publisher formatting. At that point, you got coverage for about 50% of the epub2 standard.
DNSB is online now   Reply With Quote
Old 03-24-2022, 09:31 AM   #15
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: 79,763
Karma: 145864619
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 Karellen View Post
I am happy to read this. It is the argument I took when I first started editing ebooks a year and a bit ago, when I was still on my (persistent) learning curve.. "why do I need all this code?"

I asked a similar question in another thread of mine, why is everthing class= calibre1, calibre2, calibre3, calibre_1, calibre_2. It used to annoy me so I started to strip everything out and style the base tags in the css and only add a class when I needed something different to what the base tags were styled to.
Yes, that's the way to do it. The rule is to keep it simple. But some do not. The CSS used by Standard Ebooks is a right mess. There's a thread someplace here about it. I've had a look and even posted an eBook of theirs that I've cleaned up and the code in mine works in all cases where theirs not so.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html to EPUB - added class into <html> tag etihwmot Conversion 25 08-05-2020 04:20 PM
Tag Mapper: Remove tag if another specific tag exists? ownedbycats Library Management 2 07-23-2020 10:32 PM
Aura H2O MicroSDHC card class 4 or class 10? chipro12 Kobo Reader 5 07-04-2015 02:24 AM
PRS-650 SD Card Importance? SDHC, SDHC Class 4, Class 10 etc is it important Renji Sony Reader 11 12-03-2011 12:30 PM
Detect chapters without using tag or class. tonyx3 Calibre 21 09-14-2010 09:30 PM


All times are GMT -4. The time now is 10:39 PM.


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