code for ebooks

Copy link to clipboard
Copied
Hi, does anybody know a good resource for learning how to build ebooks? To start, just something that explains how the head section should be coded would be good, and the main xhtml and css elements for the main content file. I can't see anything on the internet or in the bookshops. I don't see how I can start learning this at the moment. A dreamweaver for ePubs would be good. Thank you.
Copy link to clipboard
Copied
There's going to be nothing for Dreamweaver in this regard. InDesign is the tool that Adobe recommends for ebook creation. Here's a guide they have for it: https://helpx.adobe.com/indesign/how-to/create-ebook.html

Copy link to clipboard
Copied
thanks Ben, people have different opinions about InDesign for ebooks, it sounds like the ePub files that InDesign outputs still need work doing on them if they are going to work well with some of the big reading devices and applications. There are professional services that do this but I would prefer to learn how to do it myself. There are programmes that let you open up the InDesign ePub files and edit them. However, I can't see anything anywhere on the web or in bookshops that will help me understand what is going on when I open those files. I don't think people in the InDesign community forum will be able to help me, I don't think they are technically minded people. I know the main content file of an ebook is very similar to the main content of a webpage, it uses a form of xhtml and css, so I should be able to understand it, but I can't find any introductory explanation on coding for ebooks anywhere, not even a list and explanation of the different xhtml and css elements that are used (there are far fewer elements used than for a website according to what I've read and some of them are specific to ebooks). It's strange because there must be an authoritive list of xhtml and css elements for ebooks somewhere. Somebody needs to write a good proper teaching book on how to make ebooks, I promise you there appears to be absolutelty no good material out there to help a beginner, I was just wondering if maybe I have missed something on my internet searches
Copy link to clipboard
Copied
Well, seeing your email, and your questioning, I admit that I found myself in your shoes, a few years ago, asking myself all sorts of questions and not knowing where to really start.
I could have given you my own experience, but it would have been too subjective, and I wouldn't have any conclusive feedback as I am not widely involved in ebook publishing, but only occasionally.
So without hesitation, I just asked the question to chatGPT, (and this will certainly re-launch the debate on this subject)... I tried to ask a rather broad but framed question, asking for some formatting in the answer, and asking for the addition of links. (beware that some links may send to 404s, especially if the articles have been updated recently, but it allows you to search from there...) and, questionable or not, it lays a foundation.
By the way, I asked GPT not to be exhaustive, but to go into detail anyway.
So here is his answer:
Choosing a format and software
Determine the type of ebook you want to create and choose the appropriate format. The most common formats are
- EPUB,
- MOBI,
- and PDF.
EPUB is the most widely used format for e-readers and mobile devices. It is a free and open-standard format that can be used on most devices.
MOBI is the format used by Kindle devices. It supports features such as annotations and syncing of reading progress between devices.
PDF is a print-like format that preserves the layout and formatting of a document. It is best used for books with complex layouts, such as textbooks or technical manuals.
To learn more about the differences between ebook formats, check out these resources
- Ebook Formats: Which Format Should You Choose ?
- EPUB vs MOBI vs PDF: Which Ebook Format Should You Use ?
Select ebook creation software that suits your needs and budget. Some options include
- Calibre (free and open-source)
- Sigil (free and open-source)
- Scrivener (paid)
- Pressbooks (paid)
- Vellum (paid)
For a more detailed breakdown of ebook formats and software options, see the Book Designer’s blog
Writing and Content
Decide on the type of content you want to write and the audience you want to target. This will help you determine the tone, language, and style of your ebook.
Create an outline of your ebook to help you organize your thoughts and structure your content.
Determine if your ebook will include images or not. If it does, ensure that the images are of high quality and relevant to the content. Consider using a professional designer or using tools like Canva or Adobe Spark to create your own images.
- Determine the image format you want to use. Popular image formats for ebooks include JPEG, PNG, and GIF.
- Optimize your images for ebook viewing by compressing them to reduce their file size without sacrificing quality. You can use free online tools like TinyPNG or CompressJPEG to do this.
- Ensure that the images are appropriately sized for the ebook format you are using. For example, for EPUB files, the maximum image size should be around 2.5 million pixels, while for MOBI files, it should be around 127KB.
For more detailed information on preparing images for ebooks, check out these resources
- How to Optimize Images for Web and Performance: A Beginner’s Guide
- Image guidelines for Kindle Direct Publishing
For more detailed information on writing and content creation, check out these resources
- How to Write an Ebook: 21 Dumb Mistakes to Avoid in 2021
- How to Write an Ebook: 8 Steps to Get You Started
- How to Create an Ebook From Start to Finish [Free Ebook Templates]
Formatting and Design
Choose a design and layout that fits your content and target audience. Consider factors such as font, spacing, images, and color scheme.
Use ebook formatting software or tools to convert your manuscript into an ebook format. Some options include:
For more detailed information on formatting and design, check out these resources
Marketing and Distribution
Choose a platform to distribute your ebook. Popular options include Amazon Kindle Direct Publishing, Apple Books, and Barnes & Noble Press.
Create a marketing plan to promote your ebook. This may include strategies such as social media advertising, email marketing, and book reviews.
Consider using an ebook aggregator to distribute your book to multiple retailers. Some options include
For more detailed information on marketing and distribution, check out these resources
Adobe InDesign
Adobe InDesign is a professional publishing software that can be used to create both print and digital publications, including ebooks.
InDesign supports exporting to popular ebook formats like EPUB and Kindle formats, making it a popular choice for creating ebooks.
When creating an ebook in InDesign, it is important to set up the document correctly, ensuring the proper page size, margins, and bleed settings are in place. InDesign also has specific settings for exporting to ebook formats that should be followed.
InDesign provides tools to easily add interactive elements to ebooks, such as hyperlinks, videos, and audio files.
It is important to keep in mind that while InDesign is a powerful tool for creating ebooks, it does have a learning curve and may require some practice to master.
Here are some resources to help you get started with using InDesign for ebooks
- Création d'ebooks et d'e-magazines dynamiques
- Create dynamic e-books and e-magazines
- How to Create an eBook in Adobe InDesign
- Créez des ebooks avec les templates pour InDesign.
- Design eBooks with InDesign templates.
- 10 Essential Tips for Creating eBooks (EPUBs) in InDesign
In addition to InDesign, there are other software options available for creating ebooks, such as Scrivener, Vellum, and Sigil. It is important to choose the software that best fits your needs and budget.
Headers
The header of an ebook file contains information about the ebook such as the title, author, and publisher. It is important to ensure that this information is accurate and complete.
There are different types of ebook headers, depending on the file format. For example, EPUB files have a metadata section in the header, while MOBI files have a EXTH header.
Here are some resources to learn more about ebook headers
XHTML
XHTML is a markup language used to structure content in web pages and ebooks. It is a stricter version of HTML and follows XML rules.
When creating an ebook using XHTML, it is important to ensure that the code is valid and well-formed.
Some resources for learning XHTML include
CSS
CSS is a styling language used to control the presentation of HTML and XHTML documents, including ebooks.
When creating an ebook, it is important to use CSS to ensure that the content is visually appealing and easy to read.
Some resources for learning CSS include
It is important to note that while understanding the technical aspects of ebook creation can be helpful, it is not necessary to have extensive programming knowledge in order to create an ebook. Many ebook creation tools and software, such as InDesign and Calibre, have built-in capabilities for generating valid XHTML and CSS code.
Here's an example of an EPUB 3 header in XHTML format
xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>My EPUB Book</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<!-- Book content goes here -->
</body>
</html>
This header includes the following components
- xml declaration: Specifies the version of XML used and the character encoding.
- DOCTYPE declaration: Specifies the document type and the version of EPUB being used.
- html element: The root element of the HTML document, with the xmlns attribute specifying the namespace for EPUB metadata.
- head element: Contains metadata about the book, such as the title, character encoding, viewport, and links to stylesheets and scripts.
- title element: Specifies the title of the book.
- meta elements: Provide additional information about the book, such as the character encoding and viewport.
- link elements: Reference external resources, such as stylesheets and fonts.
- script elements: Reference JavaScript files used in the book.
Here are some resources that provide more information on how to create EPUB 3 headers
I hope this helps! Let me know if you have any more questions
chatGPT

Copy link to clipboard
Copied
Thanks Lena, it was interesting to read your reply, I recognise a lot of those links, I don't think it is the fault of chatGPT, I think there is just no information on xhtml and css for ebooks that is easy for a beginner to understand, but I still wonder how did all the technical people learn it? They must have all started in a different area that used similar xhtml and then moved to ebooks presumably
Copy link to clipboard
Copied
To clariy terms:
XML is data.
XHTML is an obsolete doc type, replaced by the HTML5 web specification.
Consult your e-publisher's documentation. Every publisher has their own specifications. And e-Readers are not created equally. So you really must know who your target audience is before you start creating e-Books.

Copy link to clipboard
Copied
I could be wrong Nancy, I'm very new to this, but I'm pretty sure ePubs are still written in xhtml. I know you can pay people to optimise your ebook for you across different devices but I would like to learn how to do it myself if possible, understanding the way the files work and being able to make small tweaks is the only way I can see of doing it, I know that in principle html languages are much more basic than standard computer languages, so even though I'm not technically minded I think it's possible, it appears there's nothing to help beginners though so I'm going to have to think about the whole thing a bit more

Copy link to clipboard
Copied
but I agree with your point Nancy about knowing your target audience if you are publishing ebooks commercially. If you only have to produce for Amazon or if most of your readers are going to be using similar reading equiptment then it makes your life a lot easier
Copy link to clipboard
Copied
It is true that this sector has never been well covered. Apart from some large distributors who integrate everything from A to Z for their own readers, individual electronic publishing, which aims at wide and multiple distribution, addresses only sporadic and essentially niche markets.
In addition, and in many cases, the interactive and responsive PDF format has always been able to provide so many solutions to electronic publishing, adaptable to any device, including print, that other formats can become more complex to deploy, and more importantly, to run concurrently.
So I am afraid that you have no other solution than going step by step and testing by yourself.
By the way, I remember that at the time we had a few books here at the studio to help us, I just looked in the shelves, but I couldn't find them anymore... from memory one was called Epub from ground, or something like that (the cover was blue), there was another one at O'reilly, red, which was a kind of cookbook... I think there were one or two others but I don't remember.
I haven't used them in a while, but they were useful, and you should be able to find them second hand, and for a few cents it would be worth a try.

Copy link to clipboard
Copied
thank you very much indeed Lena, somebody who uses indesign sent me this link yesterday http://www.idpf.org/epub/30/spec/epub30-overview-20111011.html . I've started to read it now and it looks like it's going to answer all my questions. I have read some really good introductory books on how to build websites with html and css, so I think I have a chance of understanding this document but it is going to take me a long time, a month probably, a technical person would probably be able to read it in about five minutes, my friend told me it's the closest thing for a beginner that there is on ebooks
Copy link to clipboard
Copied
Whichever resources you use, make sure they are current and not 5-10 years out of date.
Comparison of E-Book Formats:
https://en.wikipedia.org/wiki/Comparison_of_e-book_formats
Theoretically, you could create an e-book in Notepad (txt) or Microsoft Word (doc, docx or rtf) and export it to required e-book format.

Copy link to clipboard
Copied
thank you
Copy link to clipboard
Copied
Indeed, although arduous and complex in approach, the specifications remain the central document which it is recommended to use (although not all publishers respect it systematically)...
On the other hand, two points should be noted :
- The link you indicate is the 2011 version, look at the top of the page for a link to the latest version, which is from 2019
- In any case, this link points to an overview
So, if you look in the last links provided in my first comment, you will find an EPUB 3 Specification link, which points to the whole w3c specifications, and in the introduction, more particularly in point 1.1 specifications, you will find the link to EPUB Content Documents [ContentDocs32], which should then be of particular interest to you.

Copy link to clipboard
Copied
excellent, thank you

Copy link to clipboard
Copied
That link was good L e n a, thanks again. Just in case you are interested, all the information for authoring (or being able to understand and check the files of) an ePub can be found at https://www.w3.org/TR/epub-33/#sec-xhtml and its associated links. The preamble to the document it says that all the information had been scattered all over the place before, and that is for professionals so for beginners I think it's hard
Copy link to clipboard
Copied
Thanks @Deleted User I'm really sorry, I just saw that your message went through.
Thank you for your feedback, for your link, and I'm glad you were able to move forward in your research.

Copy link to clipboard
Copied
Thanks Lena, I actually saw the book you mentioned on googleplay books a few days ago (epubs from the ground up) and I thought of you. I'm still learning the technical stuff with epubs, I can see why people don't like to work with them but I still have a feeling that there is plenty interesting work and that money can be made in this area

