![]() |
#1 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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? |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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?
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#5 |
Fool
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#7 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
<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. |
|
![]() |
![]() |
![]() |
#8 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
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. |
|
![]() |
![]() |
![]() |
#9 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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??
|
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#11 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 316
Karma: 3200000
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#12 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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! ![]() |
![]() |
![]() |
![]() |
#13 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#14 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#15 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |