You are here: Using Styles in Doc-To-Help > Using HTML Styles in a Doc-To-Help Project

Using HTML Styles in a Doc-To-Help Project

Using styles for help markup has always been the central feature of Doc-To-Help. As Word styles are used in Word documents, Cascading Style Sheet (CSS) styles, or classes in HTML, are used in HTML documents. CSS styles can be used to format text for appearance only in a help file, or they can have special meaning in Doc-To-Help when it is building help targets. CSS styles used for appearance only can have any names defined in the style sheet, but the special-meaning CSS styles must be identified with corresponding Word styles having the same meaning. Since style name conventions in CSS and Word differ, for example, CSS does not allow spaces in style names, and since there are two kinds of style selectors in CSS, class and tag, a special mechanism is needed to provide one-to-one correspondence between Word styles and CSS styles. This mechanism is the Doc-To-Help property Style.HTMLHelp.

Every special-meaning style specified in a Doc-To-Help project has two names: (1) the Style.Name property that identifies it as a Word style or a Style object in Doc-To-Help if the project does not use Word, and (2) the Style.HTMLName property that identifies it as a CSS style, or selector.

Note: When you use a style in an HTML Document and that style is defined in your Doc-To-Help project, make sure you use the HTML name of the style specified in the Style.HTMLName property, not the Style.Name property.

According to the standard CSS rules, Style.HTMLName can have one of three forms:

(1)  .<stylename> - The style can be used with any HTML tag.

(2)  <tag> - The specified tag, for example, H1 for style Heading 1 is considered by Doc-To-Help as having this style, even if the user did not format this tag with any particular CSS style.

(3)  <tag>.<stylename> - The style can be used only with the specified tag; it is ignored if used in other tags.

The following are some examples of the Word style names and their corresponding CSS style names:

Style.Name Property

Style.HTMLName Property

Body text

.Bodytext

Heading 1

H1

 

Styles included by default in a Doc-To-Help project already have the appropriate HTMLName. If you add new styles to a project, the default HTMLName assigned to it is .stylename where Style.Name = stylename. Note that spaces and non-ASCII characters are removed. It means that this style can be applied to any tag in HTML. If you want to restrict the use of this style to certain tags, or if you want to associate this style with a tag in the same way that styles Heading 1,2, are associated with tags H1, H2,, you can change the value of the HTMLName property.