#### 31.8.2 Specifying CSS size values and units of measurement

By default, measurements for properties such as font size and line height are expressed in pt units in DITA2Go-generated CSS entries. You can direct DITA2Go to use other units instead. For example, if you are generating HTML Help and you want to enable the Font button on the toolbar, font sizes are best expressed in em units. Relative units (em, ex, and %) are based on whatever absolute unit (pt, pc, in, cm, mm, or px) is used for the font-size property of the <body> tag entry; see §31.8.1 Specifying CSS <body> tag properties.

You can specify how many decimal places DITA2Go should use for CSS property values; the default is two decimal places. Trailing zeros in property values are eliminated. For example, if a value is computed to be 1.00em, in the CSS file the value appears as 1em. Fractional values are rounded rather than truncated.

To specify units of measurement for font size and line height in CSS entries:

[CSS]
; CssFontUnits = units for font size and line height, default 0:
; 0=pt, 1=pc, 2=in, 3=cm, 4=mm, 5=em, 6=ex (0.5em), 7=px (pixels), 8=%
CssFontUnits=0
; CssFontUnitDec = count of digits to right of decimal in CSS font
; values: 0, 1, or 2, default 2. Trailing zeros are trimmed.
CssFontUnitDec=0

To specify units of measurement for paragraph spacing, indentation, and margins:

[CSS]
; CssIndentUnits = units for para space and indents, default 0:
; 0=pt, 1=pc, 2=in, 3=cm, 4=mm, 5=em, 6=ex (0.5em), 7=px (pixels), 8=%
CssIndentUnits=0
; CssIndentUnitDec = count of digits to right of decimal in CSS indent
; values: 0, 1, or 2, default 2. Trailing zeros are trimmed.
CssIndentUnitDec=0
; CssIndentBaseSize = value used for computing percents for margin
; settings (para space above and below, and indents) in .css file
CssIndentBaseSize=6
; CssIndentBaseUnit = units for CssIndentBaseSize, default 2 (in)
; 0=pt, 1=pc, 2=in, 3=cm, 4=mm, 7=px (pixels).
CssIndentBaseUnit=2

The base unit of measurement for computing margin settings should be an absolute unit, not a relative unit.

See also:

§31.8.1 Specifying CSS <body> tag properties

§31.8.3 Overriding styles in DITA2Go-generated CSS files

Previous Topic: 31.8.1 Specifying CSS <body> tag properties

Next Topic: 31.8.3 Overriding styles in DITA2Go-generated CSS files

Parent Topic: 31.8 Customizing CSS properties

Sibling Topics:

31.8.1 Specifying CSS <body> tag properties

31.8.3 Overriding styles in DITA2Go-generated CSS files

31.8.4 Adjusting leading (line spacing) in CSS

31.8.5 Preventing <font> tags from overriding CSS properties

Table of Contents • Index