Skip to main content

Customization

Use custom CSS classes​

You can change the look and feel of a popup.

Popup styled with custom CSS showing a blue welcome message under a button in DHTMLX Suite

Related sample: Popup. Styling (custom CSS)

Follow these steps:

  • Add one or more CSS classes with the settings you need. Place them in the <style> section of your HTML page or in a separate stylesheet. If you use a stylesheet, include it on the page:
<style>
.my-first-class {
/*some styles*/
}

.my-second-class {
/*some styles*/
}
</style>
  • Specify the name of the class you created (or several class names separated by spaces) as the value of the css property in the Popup configuration:
const popup = new dhx.Popup({ 
css:"my-first-class my-second-class"
});

For example:

<style>
.custom {
--dhx-font-color-primary: var(--dhx-color-white);
--dhx-background-primary: var(--dhx-color-primary);

margin-top: 25px;
animation: opacity .4s ease-in-out forwards;
}
</style>

<script>
const popup = new dhx.Popup({
css: "dhx_widget--border-shadow custom"
});

// show popup
</script>