Restrictions on CSS file import

The Customize DITA plugin imports a CSS file to determine the look and feel of your customized DITA topics. There are some important restrictions on the CSS files that you need to be aware of.

Only one CSS file

The plugin only imports one single CSS file. This implies that all the rules have to be listed in that single file. If you want to create your custom CSS file, it is suggested to save a copy of the default CSS file, rename it, and make modification to it.

Note: A planned redesign will enable using multiple CSS files. For example, put your overrides in a single CSS file and use the default CSS for all standard configurations.

Required CSS rules

There is no way in RELAX NG (or DTD) to differentiate between a block level or inline element. This has to be done in the CSS, by setting a display: inline rule. This rule is translated into the <TextRange> element in the EDD. Without this rule, the element will be shown as a block element.

The display: inline rule is listed at the top of the default CSS file.

Order of rules

The rules in the CSS files are processed top to bottom. This implies that the order of the formatting rules in the EDD is the same as the order in which the rules are found in the CSS file. If you have multiple context rules, only the first one that matches the context specification will be applied. This means that the ordering of rules in your CSS file should be from most specific to most generic, to prevent unwanted effects in the EDD.

Example: If you want to make the font size and/or style of a <p> dependent on its context. The order of the CSS rules determines whether you will get the desired result.
body p {
    font-size: 14pt;
}
section p {
    font-size: 12pt;
    font-style: italic;
}
The above CSS rules will make every <p> show up with font size 14 pt, as the first context (the <body> ancestor) listed in the EDD always applies. Reversing the order of these rules in the CSS corrects this problem. Another option is making the first rule more specific:
body > p {
    font-size: 14pt;
}
This specifies that only a <p> that is a direct child of <body> gets the 14 pt font size. This change may have other unwanted side effects, such as a <p> inside an <li> not getting any specific styling.

FrameMaker-specific properties

A number of formatting-related EDD properties are not available in CSS. These are added to the CSS mapping by using the vendor extension pattern of CSS. Such properties have the prefix '-fm-'. This makes the CSS valid against any CSS syntax checking tool.

section > *:first-child {
	-fm-frame-above: SingleLine;
}

Some properties that do allow mapping from CSS have extra values in FrameMaker which are not valid in CSS. In these cases, the extra FrameMaker values are mapped to a property that has the '-fm-' prefix added.

keyword {
	-fm-text-decoration: double-underline;
}	

September 29, 2022

Legal Notices | Online Privacy Policy