Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Creating CSS helper classes

Updated on December 13, 2022
Applicable to Theme Cosmos applications

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.

Before you begin: Review the existing CSS helper classes to ensure that you need the additional helper class. For more information, see Reviewing CSS helper class definitions.
  1. Create a CSS file with the helper class that you want to add to the application.
    Tip: 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 ActionsView 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:
    /*******************
    Type: Helper-class
    Name: <helper class name>
    Category: <target use>
    Description: <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.

    For example: This code adds a helper class that changes the text color to green. You can use this helper class in cells only.

    /*******************
    Type: Helper-class
    Name: text-green
    Category: cell
    Description: styling for green text
    *****************/
    
    p {
      color: #008000;
    }
  3. Attach the CSS file as an additional style sheet in your application skin.
    For more information, see Attaching a CSS to the skin.

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us