XML technologies / ePUB / Open Publication Structure / Integrating layout with CSS / Including CSS

(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)

CSS can be included in OPS files in three ways:

1. Directly on the affected element (XHTML/DTBook), using the universal attribute style. This method is deprecated. Example:

<h1 style="color: #0000FF;">

2. XHTML supports embedded CSS applying to the whole document: place the element <style> in the document head containing styles. Example:

<head><style type="text/css">h1 {color: #0000FF;} . . .</style></head>

3. Both XHTML and DTBook reference external stylesheets. XHTML again places a reference in the head’s element <link>. Example:

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

DTBook instead uses a processing instruction, not an XML element, of this form:

<?xml-stylesheet href="dtbook-styles.css" type="text/css"?>

   

Earlier OPS examples illustrated these methods. All external stylesheets must appear in the manifest (see “CSS in the manifest”).

   

 

 

 

back to top