Customization
Use custom CSS classes
You can change the look and feel of a layout by styling its cells.
Related sample: Layout. 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
cssproperty in the configuration of a Layout cell:
const layout = new dhx.Layout("layout_container",{
row: [
{
header: "Sub Block Header row",
css:"my_first_class my_second_class"
}
]
});
For example:
<style>
.layout {
color: #fff;
--dhx-background-secondary: #7a7a7a;
--dhx-border-color: #bababa;
--dhx-border: var(--dhx-border-width) solid var(--dhx-border-color);
}
.layout-rightbar {
--dhx-background-primary: #e99949;
}
.layout-content {
--dhx-background-primary: #099f8e;
}
.layout-sidebar {
--dhx-background-primary: #e949ac;
}
.layout-header {
--dhx-background-primary: #3A434A;
}
.dhx_layout-cell-inner_html {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<script>
const layout = new dhx.Layout("layout_container", {
type: "space",
css: "layout",
rows: [
{
id: "toolbar",
html: "Header",
css: "layout-header",
height: "60px"
},
// more objects
]
});
</script>