### 31.3 Understanding how DITA2Go generates CSS

DITA2Go generates CSS based on the formats to which you map the DITA elements in your document. To get the precise display you want, you might find that you need to edit the resulting style sheet in a text editor or a CSS editor. DITA2Go excludes most font tags, and optionally excludes typographic tags, because those can override CSS. What you get is very clean HTML, with @class attributes.

Although the default is to create a new CSS each time you run a conversion, there is a setting you can specify to retain the CSS as is; see §31.4 Specifying CSS file and link options. That is what we usually advise people to do if they customize the CSS. The downside is that if you define new formats (classes, in HTML) for your document, DITA2Go cannot add them to the CSS; you have to do that yourself.

DITA2Go gets the formatting information from the formats defined for your document via the [Templates]Formats file chain. DITA2Go provides reasonable starting defaults so you get good-looking results out of the box. You can change them to your taste in numerous ways; see §7. Configuring output formats.

By default, the first time you convert a document to HTML or XML, or generate HTML-based Help, DITA2Go creates a style sheet for the output. DITA2Go creates a new CSS file that contains all the paragraph and character format names from your document, based on the following:

- whatever CSS classes you assign to those formats in [ParaClasses] or [CharClasses]; see:

  §31.7.2 Mapping paragraph formats to CSS classes

  §31.7.3 Mapping character formats to tags or span classes

- whatever tags you set for those formats in [ParaTags] and [CharTags]; see:

  §30.2.1 Assigning HTML tags and attributes to paragraph formats

  §30.3 Mapping character formats.

Absent explicit CSS settings in [ParaClasses], [CharClasses], [ParaTags], or [CharTags], DITA2Go bases CSS class names on your format names, possibly reduced to fit CSS naming rules for class names; see §31.7.1 Understanding CSS class name restrictions.

See §31.7 Assigning CSS classes.

Previous Topic: 31.2 Understanding how to use CSS

Next Topic: 31.4 Specifying CSS file and link options

Parent Topic: 31. Setting up CSS for HTML

Sibling Topics:

31.1 Deciding whether to use CSS

31.2 Understanding how to use CSS

31.4 Specifying CSS file and link options

31.5 Understanding how CSS affects other options

31.6 Linking to alternate CSS files

31.7 Assigning CSS classes

31.8 Customizing CSS properties