Next Previous Up Top Contents Index

WebMaker User Guide

12.4 WML support for CSS

WML supports Cascading Style Sheets. In particular, you can specify the class attribute of HTML elements in a variety of ways.

1. The default class. Each HTML element has a default class. For elements in the main body of the web page, the default class name is the same as the name of the paragraph tag or character tag in the FrameMaker document.The default class of elements in the header of the web page is HEADER. The default class of elements in the footer of the web page is FOOTER. The default class of elements in the navigation panel is NAVPANEL. For example, if you have a paragraph tag named Bullet and you map it to L1BulletItem, your HTML will appear like this:
<LI CLASS=Bullet>Text of first bullet.
2. The CLASS attribute of conversion rules. The WML definitions of node rules, paragraph rules (including uses paragraph rules), and character rules can contain a CLASS attribute to change the default class of HTML elements produced by those rules. The node rules produce the HTML elements in the header and footer. If the CLASS attribute is provided, it specifies a new default class that overrides the default described in 1. For example, you can create a rule such as this:
PARAGRAPH "MyL1BulletItem" TYPE List
{
  LEVEL 1
  KIND Bullet
  CLASS MyBullet
  ACTIONS
  {
    write(*,listitem(text()));
  }
}
Now, if you map your Bullet paragraph tag to the MyL1BulletItem rule, the HTML will appear like this:
<LI CLASS=MyBullet>Text of first bullet.
An example of a uses paragraph rule that specifies a class is:
PARAGRAPH "Bullet" TYPE List
{CLASS MyBullet USES "L1BulletItem"}
3. The class keyword argument to HTML markup functions. All the WML functions that produce HTML markup now take an optional class keyword argument. If it is provided, it overrides the defaults described in 1 and 2. For example, you can create a rule that provides the class keyword argument to the listitem function, such as this:
PARAGRAPH "Standard-L1BulletItem" TYPE List
{
  LEVEL 1
  KIND Bullet
  ACTIONS
  {
    write(*,listitem(text(), class:Standard-Bullet));
  }
}
Now, if you map your Bullet paragraph tag to the Standard-L1BulletItem rule, the HTML will appear like this:
<LI CLASS=Standard-Bullet>Text of first bullet.

Note that WML supports CSS by writing the class attribute with a reasonable default and options for overriding the default. There are two reasons for overriding the default. The first reason is for people who already have a cascading style sheet with class names that do not map directly to the FrameMaker paragraph tags; those people can use the class attribute to specify the class names they use in their style sheet. The second reason lies in the fact that FrameMaker tags are case-sensitive but CSS class names are case-insensitive. Thus, if people have a FrameMaker template with two paragraph tag names that differ only in case, they can use the class attribute to distinguish between them by creating different names.