Logo
  • Products
    • SecOps Studio
  • Solutions
    • Pega Stack Shifter
  • Services
    • Pega Enablement
    • Pega Modernization
  • About
  • Contact
  • Blog
Code Vault

Debug and update CSS styles in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will debug UI screens using Browser developer tool and also understand how to customize the styles for the UI element.

The article was created using earlier Pega 8 version! but the core concept remains the same! Use this blog article to learn the concepts and you can try the entire tutorial in the latest versions as well. This article is applicable only for UI-Kit based applications

We will discuss two topics in this blog article.

  1. Debug and test your styles using the browser developer tool
  2. Apply CSS styles using Pega CSS rule.

We will start by showing how to debug a UI using browser developer tools 😊

How to debug UI and styling using browser developer tools?

Note: In the below screenshot, I am using edge. The look and feel of the developer tools vary based on your browser

Step 1: Open any assignment from the user portal, that contains a few UI fields.

Step 2: Place your mouse pointer on any field and right-click and select the inspect element or view source.

This opens up the Document Object Model – DOM content. The HTML content of the document.

Using the styles widget below, You can also inspect the styling on each element in your browser.

First, let’s see how the DOM content looks for Pega UI

With HTML5, pega creates a lot of div tags for sections, layouts, container formats etc.

Step 3: Open the section rule to see the configurations.

You see it is a simple section, inside the section you see a stacked layout and inside the layout you see 4 fields to capture the details.

Step 4: Now go back to the User portal and inspect the element again

Use the highlighted option to parallelly pinpoint the div tags for each corresponding UI element.

You see the below block corresponds to the section.

Keep on expanding the tags to see all the div tags and classes for the layouts and the text input fields embedded or collapsed inside.

The above picture shows div class –  flex content layout-content-stacked content-stacked content-items-maxwidth for the stacked layout we used.

Pega UI engine generates all these div tags and classes. Below you will see a custom CSS class is added in the layout configuration and you see the same in the div tags.

Scroll down and just concentrate on all the class attributes. You can reason on it on your own 😊

You see some class for labels and a class – field-item dataValueWrite for Input text.

You saw the document object model or the HTML content.

Let’s see some styling for those contents.

Step 5: Place your mouse on the stacked layout div tag and check on the styling.

Styling tab, gives you the corresponding CSS class and the style attributes.

You may also see some of the styles overridden in the stack if you scroll down. Attributes in the flex.layout-content-stacked takes high priority and overrides the attributes below

Step 6: let’s add some styling for the stacked layout

I am going to add a new attribute background Chelsea blue. Just click here to add or update attributes.

As soon as you add, you can notice the difference in your UI. So, what you did here is, you added background color as blue for the class that belongs to the stacked layout.

It doesn’t impact only our collect information section, but all other sections in the document that use stacked layout ( flex.layout-content-stacked class)

Whatever you do in Vegas, stays in Vegas!! Whatever changes you do in the developer tools, stay within the screen at the moment!!

It is all client-side changes, so if you refresh the screen (trigger server side), then all your client-side styling you did in the developer console will be lost.

You can refresh and check it 😊

How to style the UI element using CSS rules?

Before we saw some client-side changes using developer tools. So, once you do some debugging and find the right styling you can apply it in your CSS and make it permanent.

I am not going to touch more detail on the text file rule. I will save those for separate article on text file rule

Step 1: Create a new text file rule – Say CustomDemoApp as file type css

Step 2: Add the css style for the class –

It shud always follow the patter link .css class {<all your styles>}

.flex.layout-content-stacked{

  background:blue;

}

Step 3: Add the CSS file in your skin.

Note: If the style applies to your entire application, add it to your skin rule, If it applies only to specific harness rule then refer the CSS rule in the harness form.

Step 4: Now logout and login.. see the change everywhere 😁

Please discard your changes. Though I love the blue colour, it doesn’t look good as a background colour

So, what you learned from this post is, how to debug your UI using browser developers’ tools, test your styles locally from your browser, and apply the styling permanently using the CSS rules.

I hope at least a few learnt something new on the UI topic 😊

  • user-interface
Code Vault Curators

A technical team dedicated to empowering the Pega ecosystem with in-depth knowledge, guided by Premkumar Ganesan's vision.

Post navigation

Previous
Next

Pega Courses

Pega courses can be accessed at https://myknowacademy.com

Search through the blog

Tags

activity authentication background-processing case-management data-model declarative-processing email-processing file-processing pega-core-concepts pega-integration process reporting security system-administration user-interface validation

Categories

  • Code Vault

Recent posts

  • Service REST – Usage and Configurations in Pega
  • Queue processor – Usage and Configurations
  • Data Pages Usage & Configurations in Pega
  • Requestor types in Pega
  • Case Locking Mechanism in Pega

Related Articles

Code Vault

Dynamic Layouts – Usage and Configurations in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will focus on the HTML content part of the Pega application, specifically on the dynamic layouts, which is one of the most commonly used layouts in the section configuration. Consider any application/website built over any programming language. The key building blocks on high level will be HTML + CSS + […]

Code Vault

UI Skin – Formats and Mixins in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will focus on the CSS styling part of the Pega application, especially on the component formats and mixins available in the skin rule. Consider any application/website built over any programming language. The key building blocks on a high level will be HTML + CSS + JavaScript – HTML is responsible […]

Code Vault

Float concept in Pega UI

December 10, 2024 Code Vault Curators

Floating in Pega is a concept, in which we float the components on one side or to the other side of the website. Update: The concept of float remains the same across different Pega versions. The screenshots in this blog article were reused from Pega 7 version, but the dynamic layout float configuration remains the […]

About

MyKnowTech was born with a mission to bridge the gap between technical expertise and business needs. We are a boutique firm specializing in Pega solutions, delivering them with a personal touch. At the heart of our philosophy is a commitment to putting clients first.

Company
  • About
  • Leadership
  • Career
  • Contact
Resources
  • Blog
  • Services
  • Solutions
  • Insights

©  MyKnowTech B.V. All Rights Reserved.

  • Sitemap
  • Terms & Conditions
  • Privacy Policy