Table of Contents

Creating CSS helper classes


Only available versions of this content are shown in the dropdown

Make quick adjustments to the look and feel of your UI by creating a CSS-based helper class that you can use throughout your application. Helper classes style a single UI element, such as a control, and do not affect the appearance of other elements of the same kind, even if those elements use the same style format.

For example, you can create a helper class for green text. When you apply it to a button that uses the Strong style, the text on the button turns green, but other buttons that use the same Strong style format do not change.

Review the existing CSS helper classes to ensure that you need the additional helper class. For more information, see Reviewing standard CSS helper classes.
  1. Create a CSS file with the helper class that you want to add to the application.

    In the code, you can use the formats that are defined in mixins. For example, your CSS code can reference the color of the urgent mixin by using the variable $mx-urgent-color. You can access the full list of mixin variables and their values by clicking Actions View mixin variables on the skin tab, or use autocomplete if you are developing the CSS file in Pega Platform.
  2. For each helper class, before the CSS Selector, add the following comment to define the properties and purpose of the helper class:

    Depending on where you want to use the helper class, the <target use> variable can have a value of layout, cell, or layout,cell.

    This code adds a helper class that changes the text color to green. You can use this helper class in cells only.
    Code block representing a sample helper class.
  3. Attach the CSS file as an additional style sheet in your application skin.

    For more information, see Attaching a CSS to the skin.
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.