Electric Book Works Publishing reinvented for the digital age

Learning HTML and CSS

Learning how to make reflowable ebooks – epub mostly – means learning, more than anything, how to edit and eventually write HTML and CSS. Learning HTML and CSS is a chicken-and-egg thing. You have to learn them side by side to understand them, but they should be treated separately. All content should be stored and structured in HTML. All formatting (anything related to layout, look and feel) should be stored and managed in CSS.

Some HTML looks like this:

<h1>My first heading</h1>
<p>This is my paragraph.</p>

And the corresponding CSS might look like this:

h1 {
font-weight: bold;
font-family: sans-serif;
}
p {
font-family: serif;
text-indent: 0;
}

When you start learning CSS, here are some good resources:

Not all CSS rules work in ereaders (e.g. Adobe Digital Editions ignores ‘small-caps’ rules), but that is changing steadily.

Arthur Attwell 29 June 2012
This information is more than two years old, and may no longer be accurate.