Skip to main content

Customization

Styling Layout cells‚Äč

There is a possibility to make changes in the look and feel of a layout by styling its cells.

Styling cells

Related sample: Layout. Styling (custom CSS)

For this you need to take the following steps:

  • add a new CSS class(es) with desired settings in the <style> section of your HTML page or in your file with styles (don't forget to include your file on the page in this case):
<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 css property 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>