XML technologies / DocBook / Generating (X)HTML / Formatting headings / Customizing with CSS

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

The easiest way to change headings is to inspect the HTML output structure and then write a CSS rule for it. With small adjustments, the following procedure also applies to other headings. To change the font size of chapter headings, proceed as follows:

  1. Create a customization file as shown in Creating a customization file for (X)HTML. In your customization file, set the parameter html.stylesheet to your CSS file (see Adding a reference to a CSS file).

  2. Inspect the structure of your HTML file (see Structure of a generated (X)HTML file). Chapter headings have the following structure:

<DIV class="chapter"" ...> 
    <DIV class="titlepage"> 
        <DIV> 
            <DIV> 
                <H2 class="title">...

  1. Add the following rule to your CSS file:

div.chapter h2.title 
{ 
  font-size:xx-large; 
}

  

back to top