05-16-2012, 12:21 PM | #1 |
Zealot
Posts: 101
Karma: 202774
Join Date: Apr 2012
Device: none
|
What code should go into every chapter?
Hello
I wonder if there is an obligatory code that should be in every single chapter of an epub book, or if it´s enough to have it in the first chapter? I guess this <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="My Title" name="Title" /> <meta content="My Name" name="Author" /> <link href="../Styles/style.css" rel="stylesheet" type="text/css" /> <title>Book</title> </head> is obligatory (?). Anything more? |
05-16-2012, 12:55 PM | #2 | |
Well trained by Cats
Posts: 29,806
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
The Stuff between <body> tags is also not required Go read basis HTML rules. Validate your code using one of the Validation services/tools at w3.org Why are you even sweating this small stuff ? |
|
Advert | |
|
05-16-2012, 02:03 PM | #3 |
Zealot
Posts: 101
Karma: 202774
Join Date: Apr 2012
Device: none
|
|
05-16-2012, 04:48 PM | #4 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
At a bare minimum, your html file should look like this:
Code:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <link href="../Styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <h3>Chapter 1</h3> <p>It was a dark and stormy night...</p> </body> </html> The <title></title> tags are required, but since they are usually ignored by the ePub reader software, you can leave them empty. However, you should definitely keep the stylesheet reference. Also don't forget to enclose the chapter header in header tags (h1, h2, h3 ...). Otherwise you won't be able to automatically generate the toc. Last edited by Doitsu; 05-16-2012 at 04:55 PM. |
05-16-2012, 07:19 PM | #5 |
Zealot
Posts: 101
Karma: 202774
Join Date: Apr 2012
Device: none
|
That sparse, Doitsu?
Lovely. Room to breathe... |
Advert | |
|
05-17-2012, 04:01 AM | #6 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
The DOCTYPE directive is optional, anyway, you can safely remove it (and you must if there is SVG in the file).
|
05-17-2012, 12:13 PM | #7 |
Zealot
Posts: 101
Karma: 202774
Join Date: Apr 2012
Device: none
|
|
05-17-2012, 12:20 PM | #8 |
Grand Sorcerer
Posts: 27,551
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
This code goes into every (x)html file that you have included in your epub. "Chapter" is a bit ambiguous and not always relevant. And no... there's nothing inherently special about the "first" html file in your epub.
Last edited by DiapDealer; 05-17-2012 at 12:38 PM. |
05-17-2012, 04:19 PM | #9 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
|
05-18-2012, 04:59 AM | #10 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Does it? When I started validating (I don't remember if it was epubcheck or flightcrew, or both) I got an error with inline SVG and DTD and, as far as I know, the XHTML 1.1 doctype does not allow inline SVG
Have a look here: http://www.daisy.org/epub/issues/cla...e-allowed-epub particularly at message #49 My understanding now is that DOCTYPE is not necessary, but if it's used it must be the right one for the content, and HTML+SVG is not valid in the XHTML 1.1 DOCTYPE. So, if you are going to use them, either you must include a custom DOCTYPE, or just remove the line, as it's not needed anyway. |
05-18-2012, 05:00 AM | #11 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
05-18-2012, 08:15 AM | #12 | |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
It probably depends on how you use the SVG. If you embed it, there is an SVG file added. In the SVG file there is no DOCTYPE. However, if I take the content of the SVG file (only the <svg> tags and everything in between), I can past it in a normal XHTML file with DOCTYPE without an issue. I must put the <svg> in <div> tags of course, but that is normal. I usually don't do very complex things in SVG, which might be the reason why it works. |
|
05-18-2012, 08:47 AM | #13 |
Zealot
Posts: 101
Karma: 202774
Join Date: Apr 2012
Device: none
|
Thanks.
And what about this, should it go into the file? <body xml:lang="SV" xmlns:xml="http://www.w3.org/XML/1998/namespace"> Or is language only something for the CSS? |
05-26-2012, 02:56 PM | #14 | |
Resident Curmudgeon
Posts: 73,987
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ebook chapter titles: with or without chapter number? | amoroso | Writers' Corner | 16 | 06-14-2011 06:35 AM |
What are SGF Chapter Marker and Chapter Break? | webphone | Sigil | 1 | 05-25-2011 02:43 PM |
Next Chapter skips to End in last chapter? | JoGoCo | Kobo Reader | 5 | 07-13-2010 09:23 PM |
Let's create a source code repository for DR 800 related code? | jraf | iRex | 3 | 03-11-2010 12:26 PM |
K2 v K1: Chapter-to-chapter missing from some books? | Starhawk | Amazon Kindle | 4 | 03-10-2009 06:27 PM |