View Full Version : Why define a paragraph as a span with no different or extra formatting?


bfollowell
03-16-2011, 09:01 AM
I'm not sure if this is the best forum for this question or not. It applies to pretty much any ebook in any format but, since I happen to be using epub, I'll ask it here.

Maybe I'm missing something but I'm a little confused with as to something would be defined as a span with no different or extra formatting.
I mean, I've seen spans like:

<span class="italic">whatever</span>

or

<span class="bold">something else</span>

but what purpose would defining something as a span with nothing else serve? Something like:

<span>just regular old text</span>

The only thing I could see is that it just takes up space and makes the file a little larger.

Am I missing something?

I've seen similar occurrences of the <div> tag. If something isn't really different, I really don't understand the purpose of setting it apart from the rest of the text or chapter.

I have an epub that has almost every single paragraph defined as a span and I can't figure out why or if it would cause me any problems to remove a 4,000 of these occurrences.

Thanks for any advice.

Sincerely,
- Byron

HarryT
03-16-2011, 09:04 AM
The most likely explanation is that it's been put there by a tool of some sort. There should certainly be no problem with removing surplus "span" tags, but note that a "div" is a little different - it causes a line break.

bfollowell
03-16-2011, 09:16 AM
The most likely explanation is that it's been put there by a tool of some sort. There should certainly be no problem with removing surplus "span" tags, but note that a "div" is a little different - it causes a line break.

Good to know. I'll just start batch removing the vanilla <span> tags then and will consider the <div> tags on a case-by-case basis.

Thanks for the info. I really appreciate it.

- Byron

Jellby
03-16-2011, 10:41 AM
I sometimes add class-less spans like this:

<h1><span>VIII</span> Chapter Title</h1>

But of course, it's not meaningless, because in CSS I style "h1 span" (span inside h1). And even if I don't, I (or someone else) could.

HarryT
03-16-2011, 01:26 PM
You're absolutely right. That is of course a valid use for it.

bfollowell
03-16-2011, 02:13 PM
I sometimes add class-less spans like this:

<h1><span>VIII</span> Chapter Title</h1>

But of course, it's not meaningless, because in CSS I style "h1 span" (span inside h1). And even if I don't, I (or someone else) could.

I made sure it wasn't used this way before I deleted them. There were no span references anywhere in the css. Thanks.

- Byron

adv_dp_fan
03-16-2011, 05:25 PM
I did note a bug in an older version of iBooks once that would cause it to ignore centering text unless you placed a span or div like that around the text. For a while I put classless span elements in to force it to work properly.

Adjust
03-16-2011, 10:30 PM
Indesign conversion put the <span class=""> in the code