Customization
You can change the appearance of a message box or a tooltip. Create a custom CSS class or apply a built-in one from the DHTMLX library.
Use custom CSS classes
Follow these steps to apply a custom CSS class:
- 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 created CSS class (or names of classes separated by spaces) as the value of the
cssproperty in the configuration of a message box, alert box, confirm box, or tooltip:
dhx.message({
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);
--dhx-font-size-normal: 16px;
}
</style>
<script>
dhx.message({
text: "Here is dhtmlxMessage",
icon: "dxi dxi-close",
css: "custom"
});
</script>
Related sample: Message. Message styling (custom CSS)
Related sample: Message. Alert styling (custom CSS)
Related sample: Message. Confirm styling (custom CSS)
Use built-in CSS classes
The DHTMLX library includes a set of built-in CSS classes that you can apply to change the appearance of either a message box or a tooltip:
dhx.message({
css:"dhx_widget--bg_gray"
});