4. Adding a custom CSS style sheet

Procedure:

  1. Copy one of the following files depending on which configuration you want to customize:

    Configuration NameProcedure

    DITA

    Copy topic.css to custom/.

    DITA Map

    Copy map.css to custom/.

    DITA BookMap

    Copy bookmap.css to custom/.

    DocBook Assembly v5.1+

    Copy assembly.css to custom/.

    DocBook v5+

    DocBook v5.1+[a]

    Copy docbook5.css to custom/.

    DocBook

    Copy docbook.css to custom/.

    XHTML Strict

    XHTML Transitional

    XHTML 1.1

    XHTML 5

    Copy xhtml.css to custom/.

    [a] DocBook v5+ and DocBook v5.1+ documents are styled using the same docbook5.css CSS style sheet.

    For example, xhtml.css looks like this:

    @import url(xhtml-config:css/xhtml.css);
  2. Edit this file using a text editor and add one or more CSS rules after the @import directive.

    XHTML example:

    p {
        color: red;
    }

    DocBook, DocBook v5+ example:

    para {
        color: red;
    }
  3. Check your CSS file using the csscheck command-line utility. This utility is found in XXE_install_dir/bin/. Example:

    $ /opt/xxe/bin/csscheck stylesheet1.css
  4. Let's suppose this file is called stylesheet1.css and that you want your style sheet to be listed in the View menu as "Style sheet #1".

    Add the following css configuration element to your custom .xxe file:

    <css name="Style sheet #1" 
         location="stylesheet1.css" 
         alternate="true" />
  5. If you want to make your custom CSS style sheet the default one, add the following windowLayout configuration element:

    <windowLayout>
      <center css="Style sheet #1" />
    </windowLayout>