31.7.2 Mapping paragraph formats to CSS classes

When you use CSS, by default DITA2Go maps each paragraph format name to a CSS class of the same name, applying to the name any needed transformations (see §31.7.1 Understanding CSS class name restrictions).

For a paragraph format, by default the class name in the DITA2Go-generated CSS file is preceded by the tag name and a dot:

tagname.classname

The tag name comes from whatever is specified for that format in [ParaTags] (see §30.2 Mapping paragraph formats), or else <p>. Unless you assign classes explicitly, the class name is based on the paragraph format name.

For example, suppose your document includes paragraph formats Chap_Title, Heading, and Body, with the first two assigned HTML tags in [ParaTags]. DITA2Go would treat these formats as follows, provided ClassIsTag=No (see §31.7.8 Using CSS class names as tags for XML): 

FM format name

[ParaTags]

DITA2Go HTML output

DITA2Go CSS entry

Chap_Title

Chap_Title=H1

<h1 class="chaptitle">

h1.chaptitle {...}

SubHead

SubHead=H2

<h2 class="subhead">

h2.subhead {...}

Body

(no setting)

<p class="body">

p.body {...}

DITA2Go includes as many of the following properties as apply, based on the format properties in your document (as modified by any imported conversion template), for each paragraph format (class) in the CSS file:

font: [ italic | small-caps | bold ]
margin: top right bottom left
text-align: [ center | right ]
text-indent: [for first line, negative for hang]
text-decoration: [ underline | line-through ]
text-transform: [ uppercase | lowercase | capitalize ]
color: #RRGGBB

To explicitly map individual paragraph format names to CSS class names:

[ParaClasses]
; Document style name = class to use (default is based on name)
; For XML, the class is used as the tag name by default.
FormatName=classname

Or:

[ParaTags]
FormatName= class="classname"

If you assign class names to the same format in both [ParaClasses] and [ParaTags], and the class names are different, DITA2Go uses the [ParaTags] setting for backward compatibility. See §30.2.1 Assigning HTML tags and attributes to paragraph formats.

Anchor paragraph class

If your document uses a special paragraph format to anchor graphics, you can specify a class name for the anchor format:

[Graphics]
; GraphClass = class name to use for paras created to hold <img> tags
GraphClass=graphic

XML

For XML output, see §23.3.1 Deriving XML tags from format and class names.

Previous Topic:  31.7.1 Understanding CSS class name restrictions

Next Topic:  31.7.3 Mapping character formats to tags or span classes

Parent Topic:  31.7 Assigning CSS classes

Sibling Topics:

31.7.1 Understanding CSS class name restrictions

31.7.3 Mapping character formats to tags or span classes

31.7.4 Assigning CSS classes to table formats

31.7.5 Assigning CSS classes to text and table footnotes

31.7.6 Assigning CSS classes based on Unicode character ranges

31.7.7 Using link format names as CSS class names

31.7.8 Using CSS class names as tags for XML

31.7.9 Omitting tags from CSS selectors

31.7.10 Overriding CSS class for selected paragraphs

Table of ContentsIndex