Snippet so you can use Dataview Cards from Minimal theme in any theme

This snippet is 100% copied from Minimal.css.

This was inspired by this video that does most of the job but doesn’t take care of the resizing of the Cards if there are only a few of them in a table, or if you want the table to take up the max width. So I had a look at the theme code and copied out everything I thought would be useful. So far it seems it has worked, as I can now access the Minimal Cards section in Style Settings even when not using Minimal theme, so that’s a success. This part is necessary, as far as I can tell for the resizing and max width bit.

One thing I’m not sure if it’s usual is that my Cards now seem to have a bit of white space on the left of the cover image. But I can’t tell if that also occurs in regular Minimal theme version. Maybe someone can tell me.

I thought maybe this is useful to someone. I love Minimal theme, but like the option of using Cards in another theme :slight_smile:

Cards.css (60.1 KB)

EDIT fixed the padding on the left!

.table-100 table th:first-child,
.table-100 table td:first-child,
.table-100 .dataview.table-view-table th:first-child,
.table-100 .dataview.table-view-table td:first-child,
.table-100 .markdown-source-view.mod-cm6 td:first-child,
.table-100 .markdown-source-view.mod-cm6 th:first-child {
  padding-left: 20px !important; }
.table-100 table th:last-child,
.table-100 table td:last-child,
.table-100 .dataview.table-view-table th:last-child,
.table-100 .dataview.table-view-table td:last-child {
  padding-right: 20px; }

Turning the padding-left: 20px into padding-left: 0px solved it. I don’t really understand why the padding-right makes no difference in this case. I changed that to 0 too, though it doesn’t seem to make a difference.

Here’s the updated file:
Cards.css (60.1 KB)

If anyone knows how to get the Dataview table Cards to show on the full width of the note (as you can do with the Minimal Theme Settings plugin), please let me know :slight_smile:

5 Likes

Just wanted to drop a word of thanks. This was something I really wanted to solve and I was able to tweak your work to perfectly solve my problem. Really appreciate it!

1 Like

Would you care to share your tweaks? I haven’t actually moved away from Minimal Theme because with this snippet the cards didn’t take up the whole width of the note /leaf.