Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 07-19-2025, 10:06 AM   #1
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 449
Karma: 65460
Join Date: Jun 2011
Device: Kindle
<div> instead of <p>?

This may be recency bias, but i feel like I've been seeing more and more epubs that use <div> to enclose basic text instead of <p>. That is, narry a <p> to be found throughout the whole book.

To my untrained eye this seems... kinda puzzling. Is there a good reason for this kind of substitution? Does <p> have outlier cases where it fails and <div> doesn't?
ElMiko is offline   Reply With Quote
Old 07-19-2025, 01:16 PM   #2
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
Probably generated with some software that creates only <div>s and <span>s?
Jellby is offline   Reply With Quote
Old 07-19-2025, 01:21 PM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,764
Karma: 6000000
Join Date: Nov 2009
Device: many
Replacing p with div is just horrible from a semantic meaning basis. Code like that is broken imho, and as Jellby stated ... probably machine generated.
KevinH is offline   Reply With Quote
Old 07-19-2025, 03:34 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,758
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
When I find those awful (IMHO) ePub with <div> instead of <p>, I replace the <div> with <p> where it should be <p>. And because the <div> and </div> are on separate lines, I search/replace all the lines so they run on. Then I use Modify ePub to split the lines properly. I will go through the code to see if I missed any <div> that should be <p>.

Does anyone know what software is being used to screw with <p>?
JSWolf is online now   Reply With Quote
Old 07-19-2025, 07:17 PM   #5
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,220
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
I do much the same but since the divs have classes, I replace only those <div class="whatever">...</div> blocks that are where a paragraph or header tag should be.

The only pain is where there are nested divs ( <div class="flush_para"><div class="italic_text"> for example ) which do take a bit of manual cleanup.
DNSB is offline   Reply With Quote
Old 07-19-2025, 09:45 PM   #6
Sarmat89
Fanatic
Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.
 
Posts: 518
Karma: 2268308
Join Date: Nov 2015
Device: none
People are using div's because it prevents empty lines between paragraphs.
Sarmat89 is offline   Reply With Quote
Old 07-19-2025, 10:52 PM   #7
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,353
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
Why not just style the paragraph css appropriately?? Or if it’s the device inserting extra space when it shouldn’t, get a new device…. Or complain to the manufacturer!!
Turtle91 is offline   Reply With Quote
Old 07-19-2025, 10:54 PM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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
Quote:
Originally Posted by Sarmat89 View Post
People are using div's because it prevents empty lines between paragraphs.
That makes a tiny bit of sense if they only use <p> as the device default may have a margin.
But WHY not set a margin: 0 if that is what is wanted?

To me, <div> is a container to keep a grouping together. (pagebreak-inside-avoid)
theducks is offline   Reply With Quote
Old 07-19-2025, 11:53 PM   #9
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
I get those occasionally. I have an involved song and dance for how I convert a Kindle book to epub. Part of the work is done when Calibre converts it. The final/second step is opening it in Sigil and taking a big sledgehammer to its CSS with the following regexp which replaces these with nothing:
Code:
(  display: block;
|  font-size: .*
|  letter-spacing:.*
|  line-break: strict;
|  line-height: .*
| page-break-after:.*
| page-break-before:.*
| page-break-inside:.*
|  vertical-align: .*
|  white-space: pre-wrap;
)
If I see it using divs for paragraphs I use Diap's gizmo to convert all divs that are using the class it's using to ps.

This often messes up the chapter titles making them the same size as the paragraph text because many if not most ebooks use the p tag instead of the h tags for chapter titles (another unforgivable sin).

Edit: I should fix the above regexp and instead of having a space after the colon use a regexp for 0 or more spaces. I'm guessing that calibre's conversion is always putting a space after the colon.

Last edited by hobnail; Yesterday at 12:00 AM.
hobnail is offline   Reply With Quote
Old Yesterday, 12:35 AM   #10
Moonbase59
Groupie
Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.Moonbase59 ought to be getting tired of karma fortunes by now.
 
Moonbase59's Avatar
 
Posts: 172
Karma: 1000000
Join Date: Oct 2021
Location: Germany
Device: Tolino Vision 5, Tolino Tab 8", Pocketbook Era (16GB)
What really annoys me is that you see more and more of this crap in expensive e-books from large publishers. The code often looks like machine-generated, or at least done by complete idiots. Also, there’s often stuff in it to fight deficiencies of single readers.

I mean, hey, in what market are we? Pay $10–30 for a book and then have to invest hours to repair it?! It really, really sucks.

Besides, not everybody has the tools or the knowledge.
Moonbase59 is online now   Reply With Quote
Old Yesterday, 06:26 AM   #11
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,045
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
I had one ebook from a large publisher all <div> instead of <p>
From every point of view that's stupidity. If <div> is used at all, it's an extra level of structure, not a tag for body paragraphs. Clue even in the name.

How do they even manage such stupidity?

I've only spent hours "repairing" an ebook if it's badly proofed OCR to be almost unreadable and it's part of a series and otherwise unobtainable. All of those from Amazon. I learnt years ago to only download PDFs from archive dot org, because their auto generated ebook formats are an insult and mostly unusable.

Last edited by Quoth; Yesterday at 06:30 AM.
Quoth is offline   Reply With Quote
Old Yesterday, 06:35 AM   #12
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,758
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 Sarmat89 View Post
People are using div's because it prevents empty lines between paragraphs.
That's rubbish. You can use <p> without any paragraph spaces.

CSS for <p>
Code:
p {
  margin-top: 0;
  margin-bottom: 0;
  widows: 1;
  orphans: 1;
  text-indent: 1.2em;
}
JSWolf is online now   Reply With Quote
Old Yesterday, 11:55 AM   #13
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,045
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by theducks View Post

To me, <div> is a container …
Yes. So for a simple novel with no illustrations you might only have one, for the cover!
Quoth is offline   Reply With Quote
Old Yesterday, 02:00 PM   #14
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,758
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 Quoth View Post
Yes. So for a simple novel with no illustrations you might only have one, for the cover!
You gets <div> used a lot in place of <blockquote> (this annoys me) and sometimes <div> for the chapter header and then there are the empy <div> we sometimes get. If the ePub is ePub3, we may get <figure> instead of <div> for images.

So yes, there can be <div> even if the only images are the cover and the title page.
JSWolf is online now   Reply With Quote
Old Yesterday, 02:23 PM   #15
Sarmat89
Fanatic
Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.
 
Posts: 518
Karma: 2268308
Join Date: Nov 2015
Device: none
Quote:
Originally Posted by Quoth View Post
From every point of view that's stupidity.
DIV is a generic block type. It works as good as P, but requires less work to generate.
Sarmat89 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using <p> instead of <div> goderic Sigil 4 09-25-2024 11:12 AM
A tag that's new to me <div/> DyckBook Editor 7 11-13-2021 02:30 AM
<div> problem alheva Marvin 30 08-23-2016 09:13 PM
duplicate div id's thiefwriter ePub 6 09-17-2011 11:00 AM
Center a div marcelo2605 ePub 4 05-13-2011 07:39 AM


All times are GMT -4. The time now is 04:29 PM.


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