Inserting CSS, especially the one that affects only part of the tables, is tricky in DataviewJS. Currently, out of my head, you would need to make a table from 3 parts: header, data and footer (total), and each append to the main table. And in the footer, apply CSS.
I use mostly containers. Something like this:
// Render container with custom class
dv.container.className += ' custom-table-css';
It’s hard to play with dynamic tables, but it is easier if they are fixed.
In the post below I show some various options to attach stuff to any dataview queries. Once you’ve some selector to it, you could opt for using stuff like :last-child or having a tag in the cell you want to style. Or even add the style directly into the cell using dedicated code.
Thanks for the help, but I don’t know much about Javascript, I don’t know how to set up this query.
I read your article, but the CSS you mentioned is inside the dataviewjs query or is it a snippet that is called inside the query?
[href=^"#_"] {
display: none;
}
table:has([href="#_/uniqueTableId"] {
/* Whatever styling I'd like applied to this table */
& thead > tr {
background-color: blue;
}
}
If it’s not too much trouble, could you just change the color of the results (Total) that’s all I want, so I save this post, if you want to replicate it just read this post again.