31.4.1 Specifying CSS options in a DITA2Go configuration file

To specify CSS options in a DITA2Go configuration file:

[CSS]
; UseCSS = Yes (default) or No
UseCSS=Yes
; WriteClassAttributes = Yes (default)
;  or No (when ClassIsTag=Yes or when not using CSS)
WriteClassAttributes=Yes
; WriteCssStylesheet = Once (default), Always, or Never
WriteCssStylesheet=Once
; WriteCssLink = Yes (default) or No
WriteCssLink=Yes
; CssBrowserDetect= Macro reference to JavaScript code that determines
; browser type and writes link from HTML to appropriate CSS file
;CssBrowserDetect=<$BrowserCSS>
; CssFileName = name of style sheet to reference (file name, no path)
CssFileName=local.css

Use these options to do the following:

Direct DITA2Go to use CSS

Include class attributes

Designate a CSS file

Create a CSS file

Link to a CSS file

Select a CSS file at run time

See also §Table 31-2 CSS-dependent default values of options.

Note:  If you have been using [HtmlOptions]Stylesheet to specify CSS file options, see §31.4.4 Understanding effects of the older Stylesheet setting. The Stylesheet setting is deprecated in favor of the [CSS] settings listed in this section.

Direct DITA2Go to use CSS

To direct DITA2Go to use CSS for your output:

[CSS]
; UseCSS = Yes (default) or No
UseCSS=Yes

When UseCSS=Yes, by default DITA2Go does the following:

When UseCSS=No, paragraph tags do not include class attributes, no CSS file is referenced in the output, and the remaining [CSS] options are ignored.

See also §31.5 Understanding how CSS affects other options.

Include class attributes

WriteClassAttributes values have the following effects: 

Yes

DITA2Go includes CSS class attributes in the paragraph tags in your output; see §31.3 Understanding how DITA2Go generates CSS.

No

Class attributes are not included in paragraph tags. Use this setting for XML output when [CSS]ClassIsTag=Yes, the default for XML; see §23.3.1 Deriving XML tags from format and class names.

Designate a CSS file

CssFileName designates the CSS file DITA2Go optionally creates and references. The default is local.css, located in the project directory. You can specify a different name and location for this file; see §31.4.2 Designating and locating a CSS file.

Create a CSS file

WriteCssStylesheet values have the following effects: 

Once

DITA2Go creates a new CSS file based on your formats, but only if no CSS file of the name designated by CssFileName is already present in the project directory. This is the default DITA2Go puts in place at set-up. Specify Once to get a starting CSS file that you can tweak manually. See §31.4.3 Directing DITA2Go to generate a CSS file.

Always

DITA2Go creates a new CSS file based on your formats, overwriting in the project directory any existing CSS file of the name designated by CssFileName. Specify Always if you do not need to tweak the CSS file, or if you can make any needed changes in macros, either in the configuration file or in a macro library. See §31.4.3 Directing DITA2Go to generate a CSS file. You can specify additional settings to govern what DITA2Go includes in a CSS file; see §31.8.3 Overriding styles in DITA2Go-generated CSS files.

Never

DITA2Go does not create a new CSS file, nor overwrite an existing file. When UseCSS=Yes, DITA2Go assumes you wish to use an existing CSS file: either the file designated by CssFileName, or a file to be selected at run time, depending on the values of WriteCssLink and CssBrowserDetect. Specify Never if you want to use an existing CSS file. See §31.4.2 Designating and locating a CSS file.

Link to a CSS file

WriteCssLink values have the following effects: 

Yes

If CssBrowserDetect is not present, DITA2Go includes in the <head> element a simple link to the CSS file designated by CssFileName, in the relative directory designated by CssPath. The link is one of the following types:

For HTML:

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

For XML:

<?xml:stylesheet href="local.css" type="text/css" charset="UTF-8"?>

If CssBrowserDetect is present, instead of the simple link DITA2Go includes the macro assigned to CssBrowserDetect in the <head> element. See §31.6.1 Selecting a CSS file at run time.

No

DITA2Go does not create a link to a CSS file. Use this setting when you are not using CSS, or when you provide your own macro in [Inserts]Head to select a CSS file dynamically, independently of CssBrowserDetect. See §31.6.1 Selecting a CSS file at run time.

Select a CSS file at run time

When a macro is assigned to CssBrowserDetect, if WriteCssLink=Yes, the macro is included in the <head> element. If WriteCssLink=No, the macro is ignored. See §31.6.1 Selecting a CSS file at run time.

Previous Topic:  31.4 Specifying CSS file and link options

Next Topic:  31.4.2 Designating and locating a CSS file

Parent Topic:  31.4 Specifying CSS file and link options

Sibling Topics:

31.4.2 Designating and locating a CSS file

31.4.3 Directing DITA2Go to generate a CSS file

31.4.4 Understanding effects of the older Stylesheet setting

Table of ContentsIndex