CRMJettyBack to crmjetty.comContact us
Menu
Docs / Guides

CRMJetty Portal

Works with
Docs / Dynamics 365

Dynamics 365 Customer Portalv6.3.0

Docs / Salesforce

Salesforce Customer Portalv6.3.0

Docs / Business Central

Business Central Portal

Guides / Widgets

How to Add Custom HTML IDs and CSS Classes to Widgets

3 min readUpdated
Short answerOpen the page in Design → Page Builder, select the Settings icon on the widget, and enter an HTML Class and HTML ID in the widget's settings section. Use no spaces. The portal adds the prefix custom- to the ID. Select Save and publish the page.

Every widget has an HTML Class and an HTML ID setting. Use them to give a widget a name you can target from custom CSS, for example to change the color of one button, or from custom JavaScript. You can do the same for whole page sections.

Before you start

Add a class and ID to a widget

  1. Go to Design → Page Builder and open the page in edit mode.
  2. Select the Settings icon on the widget.
  3. Scroll to the widget’s settings section at the end of the panel, for example Video Settings, Chart Setting or Data Card Setting.
  4. Enter the HTML Class.
  5. Enter the HTML ID.
  6. Select Save.
  7. Select Publish to apply the change in the portal.
Widget configuration panel scrolled to the settings section, showing the HTML Class, HTML ID and Card View fields filled in
Widget configuration panel scrolled to the settings section, showing the HTML Class, HTML ID and Card View fields filled in
Widget configuration panel scrolled to the settings section, showing the HTML Class, HTML ID and Card View fields filled in
Widget configuration panel scrolled to the settings section, showing the HTML Class, HTML ID and Card View fields filled in
Setting Rules Example
HTML Class One or more classes, separated by commas. The same class can be used on several widgets on a page. highlight,promo-box
HTML ID One unique ID per widget. The portal adds the prefix custom-. An ID can be used on only one element per page. welcome-video, which the portal renders as custom-welcome-video

Important: Do not use spaces in classes and IDs. If you need special characters, use only hyphens (-) or underscores (_).

The same section also has Card View, which shows the widget inside a card-style container.

Where the class and ID are applied

The portal does not add the class and ID to the widget’s own elements. It adds them to the <div> that wraps the widget. Write your CSS selectors and scripts for that wrapper and the elements inside it.

For example, with HTML Class promo-box and HTML ID welcome-video (rendered as custom-welcome-video), this custom CSS adds a border to the wrapper and styles headings inside the widget:

.promo-box {
  border: 2px solid #0a66c2;
  border-radius: 8px;
  padding: 16px;
}

#custom-welcome-video h2 {
  color: #0a66c2;
}

Use a class when the same style applies to several widgets. Use an ID when you need to target one widget only, for example from JavaScript.

Add a class and ID to a page section

Sections have the same two settings. Select the Settings icon at the top right of the section to open Section Configuration. See How to Create Pages in CRMJetty Portal.

Troubleshooting

Your CSS has no effect on the widget: Check that you published the page after saving the widget settings. Then check that your selector targets the wrapper <div> or an element inside it, not the widget’s own element, and that the ID includes the custom- prefix.

A class or ID with spaces does not work: Remove the spaces, and use only hyphens or underscores as special characters.

Did this solve it?No, contact support