Format Your Own Damned Book Part VI -- Style Sheets

Most authors would like their e-books to look as much as possible like their printed books if they have one, or at least like a printed book. E-readers like the Kindle that support style sheets make that possible. Those that don't, like the Nook, do not.

As mentioned previously, headings, paragraphs, block quotes, numbered lists, etc. make up the structure of your document. A heading 1 will always appear in a larger font than a heading 2, and so on. With the Nook these structural elements have a pre defined look, and you can make all the fonts larger and smaller, but that's it.

With e-readers that support style sheets you have some control over the look of the different structural elements, and you can define your own custom styles for things that are not structural elements in HTML, like the title and author of your book on the title page.

The following is a Style Sheet you can adapt for your own e-books:


@font-face {
font-family: Yataghan;
src: url('../Fonts/yataghan.ttf');
}

@font-face {
font-family: Akashi;
src: url('../Fonts/akashi.ttf');
}

p {
text-align: left;
text-indent: 0;
margin-bottom: .5em;
}

p.title {
font-family: Akashi;
font-size: 3em;
text-align: center;
margin-top: 3em;
margin-bottom: .5em;
clear: both;
}

p.author {
font-family: Akashi;
font-size: 2em;
text-align: center;
margin-top: 2em;
margin-bottom: .5em;
clear: both;
}

h1, h2, h3 {
font-family: Yataghan;
text-align: center;
margin-top: 3em;
margin-bottom: .5em;
clear: both;
}

blockquote {
text-align: left;
text-indent: 0;
margin-bottom: .5em;
margin-left: .5in;
margin-right: .5in;
}


Note that each structural element has attributes defined for it, including some with custom fonts. Custom fonts are shown in every advertisement for the Kindle, but are not shown by default. You need to go to the Change Font Size menu and select Publisher Font to be on. Since most of your customers won't do that, most will never see any custom fonts you supply. They won't appear in the preview for the book on the Amazon website either. I include them anyway, mostly to please myself. I get my fonts from https://www.fontsquirrel.com/ but there are many other sites offering free fonts which are only a Google search away. Even if you don't use a fancy font for your chapter headings you'll likely want to use one for your cover image.

If you decide you don't want to use a custom font for your e-book you can remove the font-family entry in the style sheet above and leave everything else as is.

Other style attributes always get shown. The attributes for P are useful in any book. The ones shown display text with a "ragged right" margin (default is a straight margin on both sides), eliminates indenting of the first line of a paragraph, and puts spacing between paragraphs.

Notice that when I specify a font size or a top and bottom margin I do it with "em" instead of inches. One "em" is the size of a capital "M" in the default font size, so if the customer chooses to make the text in the book larger or smaller everything will stay in proportion.

I use inches for the blockquote indent because I don't want those to change when the customer adjusts the text size.

Again, you can define custom classes for things like Title and Author, as shown below:


<body>
<p class="title">The Bhagavad Gita</p>

<p class="author">Veda Vyasa</p>


These classes are defined in the example style sheet as p.title and p.author respectively.

To use a style sheet put the text in a file named ebook.css and put it in the Styles folder in Sigil. Then add the following to your HTML page HEAD section like this:


<head>
<title></title>
<link href="../Styles/ebook.css" rel="stylesheet" type="text/css"/>
</head>


The results will look like this in Sigil:



They will look pretty much like that in the Kindle.

In the next installment we will consider how to make attractive cover images,
 •  0 comments  •  flag
Share on Twitter
Published on October 24, 2016 09:16
No comments have been added yet.


Bhakta Jim's Bhagavatam Class

Bhakta Jim
If I have any regrets about leaving the Hare Krishna movement it might be that I never got to give a morning Bhagavatam class. You need to be an initiated devotee to do that and I got out before that ...more
Follow Bhakta Jim's blog with rss.