Scrollable dataview table with frozen headings

What I’m trying to do

My Dataview tables are quite long and I am looking to modify the table so the height is restricted, the table is scrollable (vertically and horizontally), and the header locks.

Things I have tried

I changed by obsidian.css file and the following code restricts the height and makes the table scrollable in both the vertical and horizontal directions.

.block-language-dataview{ display: block; height: 400 px; overflow:auto;

However, when I try to add in position: sticky it does not freeze the header.

2 Likes

Hi.
This CSS code worked for me. Maybe it´s what you need.

th {
  position: sticky;
  top: 0; /* Sticks the headers at the top */
  z-index: 999; /* Ensures headers are above other elements */
}

Freeze columns Obsidian Dataview

1 Like

What will be the code for both scrollable???

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.