View Single Post
Old 11-10-2019, 01:50 AM   #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 fdwojo View Post
Thus, is there any reason (for ebooks) to use XHTML?
XHTML + XHTML5 are what the EPUB specs require.

There are a few (more technical) differences between HTML + XHTML, but the only real surface level thing is that XHTML is more strict.

Here are a few examples:

1. If you have an open tag, XHTML requires you have a closing tag.

So something messy like this is "valid" (but poor) HTML:

Code:
<p>This is paragraph 1.
<p>This is paragraph 2.
where in XHTML, for every <p> you need a closing </p>:

Code:
<p>This is paragraph 1.</p>
<p>This is paragraph 2.</p>
2. In HTML, you can have busted nesting like this:

Code:
<p><b>This is bold.</p></b>
but in XHTML, you must nest the tags properly:

Code:
<p><b>This is bold.</b></p>
3. Standalone tags have to close too. So in HTML:

Code:
<br>
<img src="example.jpg">
but in XHTML, you need the closing slash:

Code:
<br />
<img src="example.jpg" />
Quote:
Originally Posted by fdwojo View Post
In fact, when I edit my EPUBs, I tend to change all text files to either HTML or CSS. If I see an XHTML, I generally rename it to HTML.
As Diap has said, you just changing the .html to .xhtml isn't changing anything... the underlying code is all still XHTML: Sigil makes sure of it.

So if you put in poorly formed HTML, it will all be nested properly + cleaned up to the best of Sigil's ability.

Paste those code examples above into Sigil's Code View and then Tools > Reformat HTML > Mend and Prettify All HTML Files and see what happens.

Last edited by Tex2002ans; 11-10-2019 at 02:00 AM.
Tex2002ans is offline   Reply With Quote