Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 11-07-2021, 09:05 PM   #1
DyckBook
Morlock
DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.DyckBook ought to be getting tired of karma fortunes by now.
 
DyckBook's Avatar
 
Posts: 34
Karma: 2734796
Join Date: Oct 2021
Device: Kindle Paperwhite
A tag that's new to me <div/>

I've recently run across this self closing tag in a few books, but it looks like it should actually be </div> and not <div/>. In fact the check book tool throws an error, so clearly it's not effective in closing the <div> tag.

Is this to be used in some specific situation? Can you cast any light?
DyckBook is offline   Reply With Quote
Old 11-07-2021, 09:16 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
<div/> is the same as <div></div>
kovidgoyal is offline   Reply With Quote
Advert
Old 11-12-2021, 08:36 PM   #3
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
<div/> is the same as <div></div>
I can see <br/> as a self closing tag being useful, how (why) would anyone use something the same as <div></div>, i.e. nothing being grouped?

Just curious
phossler is offline   Reply With Quote
Old 11-12-2021, 09:53 PM   #4
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by phossler View Post
I can see <br/> as a self closing tag being useful, how (why) would anyone use something the same as <div></div>, i.e. nothing being grouped?

Just curious
I would never use it, but perhaps they could use it for a scenebreak.

You can use CSS's ::before + ::after + content to insert stuff like images, asterisks, or have certain text be spoken out loud during Text-to-Speech:

https://codersblock.com/blog/diving-...eudo-elements/
Tex2002ans is offline   Reply With Quote
Old 11-12-2021, 10:34 PM   #5
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,211
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Tex2002ans View Post
I would never use it, but perhaps they could use it for a scenebreak.

You can use CSS's ::before + ::after + content to insert stuff like images, asterisks, or have certain text be spoken out loud during Text-to-Speech:

https://codersblock.com/blog/diving-...eudo-elements/
For a scene break I think the correct tag would be <hr/>.
I use <div/> for separators (a line below a chapter title, for example). This is just decorative and you should not use a <hr/> tag, since it means a thematic break in HTML5.

Click image for larger version

Name:	2021-11-13 (1).png
Views:	229
Size:	304.9 KB
ID:	190182
thiago.eec is offline   Reply With Quote
Advert
Old 11-12-2021, 11:25 PM   #6
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,586
Karma: 14328510
Join Date: Nov 2019
Device: none
Many tags that you see as a begin and end pair can also be given as the singular with the slash at the end. For example, I tried all of these and none gave an error with EpubCheck.
Code:
<p/>
<em/>
<b/>
<span/>
<body/>
As for why, I agree with Tex2002ans, you could use them with a class and a css combinator. (I'd be interested to see useful examples with the em and b singular tags because I can't think of any at the moment.)

Not related to this, but speaking of hr tags and combinators, in my stylesheet.css I have
Code:
hr + p {
  text-indent: 0;
}
So that paragraphs after an hr aren't indented. All of my p tags are naked/classless.

Last edited by hobnail; 11-12-2021 at 11:28 PM.
hobnail is offline   Reply With Quote
Old 11-12-2021, 11:37 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by phossler View Post
I can see <br/> as a self closing tag being useful, how (why) would anyone use something the same as <div></div>, i.e. nothing being grouped?

Just curious
There is no how or why In EPUB you dont have HTMl you have XHTML which is XML. In XML *any* tag can be self closing, regardless of whether it is useful or not.
kovidgoyal is offline   Reply With Quote
Old 11-13-2021, 02:30 AM   #8
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by thiago.eec View Post
For a scene break I think the correct tag would be <hr/>.
I use <div/> for separators (a line below a chapter title, for example). This is just decorative and you should not use a <hr/> tag, since it means a thematic break in HTML5.

Attachment 190182
Yes, I wrote a lot about this. See the discussion in:

especially posts #128 and beyond. Me + Hitch went breaking down pros/cons of "<hr/> as scenebreaks".

Personally, I just use simple, centered asterisks. Not relying on CSS3 or complicated overrides (these will fail across many older readers/devices).

Side Note: The one nice thing about <hr/> in HTML5 is it generates a new <section> in the Accessibility Tree. I described some of that in post #148 of that thread. This would allow a screen reader to easily jump between scenes (or sections of an article) without the need for extra markup.

Quote:
Originally Posted by kovidgoyal View Post
There is no how or why In EPUB you dont have HTMl you have XHTML which is XML. In XML *any* tag can be self closing, regardless of whether it is useful or not.
EPUB3 is HTML5... and in HTML, you can do all this really funky/obscure stuff.

Like I remember running across a Sigil "bug" with:

Code:
<p">
(It was a bad search/replace I did.)

Sigil would completely crash with Reports, Spellcheck Lists, etc., but other things like Preview worked fine...

KevinH dug into this, and turns out, it's actually "valid" (but VERY horrible) HTML5. I convinced KevinH to match Calibre's parsing of this, by changing it into an underscore:

Code:
<p_>
so at least things would still work. Then epubcheck can warn you about non-standard tags at a later date.

Note: EPUB2 is XHTML1.1, and EPUB3... many tools like Sigil/Calibre conform to XHTML5—accepting HTML5's new tags, but still enforcing XHTML's stricter rules... like always closing your tags and using quotes around your attributes.

This is just good practice, and I have no idea why you'd NOT want to use XHTML5.

Last edited by Tex2002ans; 11-13-2021 at 02:53 AM.
Tex2002ans is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sigil div tag issue HELP ebookscovers Sigil 12 06-02-2021 09:48 AM
Tag Mapper: Remove tag if another specific tag exists? ownedbycats Library Management 2 07-23-2020 10:32 PM
Ways for the parent tag to not be shown with the child tag in the tags column? icecold Calibre 3 03-16-2020 10:23 PM
html img tag versus svg wrapped image tag hobnail ePub 8 02-27-2020 03:16 AM
How to show books with only 1 tag? Dynamic tag or virtual library? cd2013 Calibre 4 03-01-2019 06:41 PM


All times are GMT -4. The time now is 09:00 AM.


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