![]() |
#61 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,762
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
It is the same function. But doing it in the editor lets you see what's been removed. You can also do other editing you might want to do.
|
![]() |
![]() |
![]() |
#62 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
|
![]() |
![]() |
Advert | |
|
![]() |
#63 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,062
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
In addition, there is a editor plugin that can be used to cleanup pesky spans or divs by class=name
|
![]() |
![]() |
![]() |
#64 |
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,827
Karma: 7943430
Join Date: Mar 2015
Device: Kindle, iOS
|
Calibre is truly powerful. I know I've just scratched the surface. It's like an onion!
![]() I've been experimenting with removing unused CSS via the command line (ebook-polish -u). I didn't see any options in the Calibre manual that will trigger a listing of what was removed. Did I miss it somewhere? I will explore that plug-in for removing those irritating empty <spans> (where do they come from and why? why? why?) |
![]() |
![]() |
![]() |
#65 |
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
|
Sometimes I use empty spans to designate a special span inside of another element. There is no reason to give it a special class as long as you define it properly in your css file.
Code:
h2 {font-size:1.2em; text-transform:uppercase} h2 span {display:block; font-size:.8em; text-transform:none; font-variant:small-caps} <h2>Chapter One <span>The Woes of CSS</span></h2> I do agree with you that there are really annoying publishers that go empty span crazy for no reason at all... Code:
<p class="first-letter-in-a-new-section-of-text text-overide-party-on-dude"> <span><span><span>I</span></span>'d</span> like to say...</p> CSS: first-letter-in-a-new-section-of-text {font-size:1em} text-overide-party-on-dude {} |
![]() |
![]() |
Advert | |
|
![]() |
#66 | ||
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
That kind of in-depth analysis is only available via the special Editor feature for showing the difference between two checkpoints. (Remove Unused CSS like most global tools creates a checkpoint. Then it offers to show you What Changed.) Quote:
![]() Or because you just cleaned up unused CSS -- there is an option to cleanup unused classes as well. Very handy for Kobo or Google Play books which include squillions of junk spans for bookmarking purposes. ![]() |
||
![]() |
![]() |
![]() |
#67 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
![]() spans weren't made to provide an extra tag selector for matching CSS. They were made to provide an arbitrary class selector, and you should use them for what they are meant for. (Otherwise your code is ugly. ![]() And it saves you from falling prey to heuristics. But no one said you have to use the plugin either. |
|
![]() |
![]() |
![]() |
#68 | |
Testate Amoeba
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,049
Karma: 27300000
Join Date: Sep 2012
Device: Many Android devices, Kindle 2, Toshiba e755 PocketPC
|
Quote:
I've done some automated generation of epubs from databases and going from the sloppy-but-valid stage to something more refined is often a non-trivial amount of work. |
|
![]() |
![]() |
![]() |
#69 | ||
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
|
Quote:
![]() I've seen <small> used like that but <span> is 20% shorter and <big> isn't supported in HTML5 ![]() I didn't realize <span>s were designed specifically/solely as a class selector. I thought classes could be applied to any element and that spans were simply to structurally differentiate a... well... span of characters. Not unlike the <em> tag which allows you to identify some text as emphasized. Then 'emphasize' it however you want using css and/or define them using different classes. Some people are even happy with no classes and relying on the default for most readers (simple italics). I completely understand the uselessness of nested empty spans and/or those with no corresponding css. Quote:
![]() |
||
![]() |
![]() |
![]() |
#70 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
And I've never seen the point of them anyway -- you should be using b and i, they're shorter. ![]() If you want to style them so they work differently, well, you can do some pretty crazy stuff with CSS, and mostly ignore what tags are "supposed to" do. But span is a no-op. It has no structural meaning, and no fundamental styling quirks. All it does is redefines an arbitrary chunk of characters (allowing you to slap a label on it), unlike every other tag. Redefining the default nature of a tag is something to be done with deliberation. ![]() So why ask for trouble? ... The reason I suggested matching on "small" wasn't because there is a tag like that. It's because if you are going to use a span, use a span class="small" Classes rule. "but <span> is 20% shorter" is an excuse. You can probably get away with it, though. Just pointing out that when you say "but it's shorter" you are quite obviously valuing short and quick over meticulous devotion to correctness. One place where you won't get away with it, is when anyone tries applying heuristics to your work. And the appropriate response is not "breathe down the neck of anyone who ever writes a heuristic to make sure it knows about all the crazy things @Turtle91 (or ____) might do". Down that road lies madness. Of course, additional checks might be a useful feature, but depending on them? |
|
![]() |
![]() |
![]() |
#71 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,062
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Re: is shorter excuse
<span class="small" usage should be an EXCEPTION to the base <Body>, <P>, <Div> style, not frequently appear. Since it is a limited (in frequency) use, the few characters saved ![]() IIRC there are a few special cases where a nested <span> worked around a device flaw. Again, those are exceptions |
![]() |
![]() |
![]() |
#72 | |||||
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
|
Quote:
![]() According to W3Schools - The Span element: Quote:
The EM tag: Quote:
While most browsers and readers will display using the default value - italic - it is not 100% guaranteed and one SHOULD define what they want via css. Other "phrase tags" are: strong, code, samp, kbd, and var, which may have different levels of default styling/support. As for the <b> and <i> tags... Quote:
This makes clear the intent to differentiate between <em> structurally emphasized text and styled <i> italic text. Tell me how a device that is reading aloud your book will present text with an <i> tag...which is a visual styling?? If you define it as <em> emphasized then the device could give more stress to the word with more volume, or whatever you decide in the css. Quote:
![]() <h2>Chapter One <span class="Rumpelstiltskin-has-a-wart-on-his-nose class-overide-chapter-title-name">Wut?</span></h2> But this is so much more elegant, does the exact same thing, validates, follows the rules, etc. <h2>Chapter One <span>Wut?</span></h2> When I clean up a book, I am able to get it to look just like the original, but at usually half (or less) the original file size. A big chunk of that savings is cutting out unnecessary spans, divs, styles, and classes that are repeated multiple times in a book. I had one 5MB book that I got down to about 600KB!! Don't authors get charged more if their file size is too large?? It seems authors would naturally wish to keep file size down. OK...time for me to actually get something done around here... ![]() Cheers! |
|||||
![]() |
![]() |
![]() |
#73 | |
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,827
Karma: 7943430
Join Date: Mar 2015
Device: Kindle, iOS
|
Quote:
The other one that really gets me is when every paragraph is placed in a span: Code:
<p class="indent"><span>This is paragraph one. Does it really need to be in a span?</span></p> <p class="indent"><span>The answer to that would be a big fat NO.</span></p> <p class="indent"><span>And yet, every single paragraph in the entire book is in a class-less span.</span></p> Thanks everyone for all the insights on empty <span>! Interesting stuff. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Screen background color 2014 Kindle basic vs 2013 basic | bounce | Amazon Kindle | 1 | 01-08-2015 03:50 PM |
Cleaning ePubs: automatically, fast and with as many generic rules as possible | ibu | ePub | 118 | 04-04-2014 10:31 AM |
REALLY basic, basic, basic questions | MrB | Amazon Kindle | 3 | 10-22-2012 06:43 AM |
trouble when converting many epubs to epubs | comet | Conversion | 13 | 03-21-2012 01:57 AM |
Touch Problem with all epubs, my epubs, or my kobo? (line clipping) | plague006 | Kobo Reader | 14 | 12-02-2011 11:32 PM |