Defining styles for class selectors

Class selectors define style rules in the context of a specific HTML element or as a generic component. When applied to a specific element, the class is available only with the associated tag. Generic classes are available as attributes for any tag.

For example, to apply a class at the tag level, you can define a tag as:

H1.NewStyle {font-family:arial; font_color:navy;}

In an HTML document, the tag would be referenced as H1.NewStyle. The NewStyle class is available only to H1 tags.

As a generic class, you could define the NewStyle class this way:

NewStyle {font-family:arial; font_color:navy;}

To implement this style in an H1 tag, you would use this syntax:

<H1 CLASS="NewStyle">

The Insert New Class Selector dialog includes the following well-known classes (also called pseudo-classes):

:active

:focus

:after

:hover

:before

A:active

:first-child

A:hover

:first-letter

A:link

:first-line

A:visited

StepsTo define styles for classes:

  1. Right-click an item in the left pane of a style sheet editor, then select Insert Class Selector from the pop-up menu. (See “Global Style Sheet editor restrictions”.)

  2. Select or type a class name in the Insert New Class Selector dialog box.

    You can define styles for a new class or for existing classes.

  3. Click OK to create a generic class

    or

    To assign the class to an HTML tag, select the For HTML Element check box. Then select an element and click OK.

    Shown is the Insert New Class Selector dialog box. The Class Name field at top shows the entry : first - letter. The check box labeled For H T M L Element is selected, and the P element is selected in the drop down list box below it.
  4. With the new class selected in the left pane, define styles for the class in the tab pages in the right pane.