Skip to content

Commit 087eca9

Browse files
committed
fix(docs): force scrollable table wrapper to enable sticky headers
1 parent b7dc39c commit 087eca9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

docs/theme/pagetoc.css

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,18 @@
186186

187187
/* Table formatting for horizontal scrolling with column width control */
188188
.table-wrapper {
189-
overflow-x: auto;
189+
overflow: auto; /* Enable both X and Y scrolling */
190+
max-height: 85vh; /* Limit height to viewport to create scrolling context */
190191
width: 100%;
192+
margin-bottom: 1.5em;
193+
border: 1px solid var(--table-border-color);
194+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
191195
}
192196

193197
.page-wrapper table {
194198
width: 100%;
195-
border-collapse: collapse; /* Ensure borders behave */
199+
border-collapse: separate; /* Required for sticky borders in some browsers */
200+
border-spacing: 0;
196201
}
197202

198203
/* Sticky Table Headers */
@@ -203,7 +208,22 @@
203208
background-color: var(--bg); /* Ensure header isn't transparent */
204209
color: var(--fg);
205210
border-bottom: 2px solid var(--table-border-color);
206-
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4); /* Optional: shadow to define header bottom */
211+
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
212+
}
213+
214+
/* Sticky First Column (Optional: Improves readability for wide tables) */
215+
.page-wrapper table tbody td:first-child,
216+
.page-wrapper table thead th:first-child {
217+
position: sticky;
218+
left: 0;
219+
background-color: var(--bg);
220+
z-index: 15; /* Below header, above content */
221+
border-right: 1px solid var(--table-border-color);
222+
}
223+
224+
/* Header of first column needs higher z-index to stay on top of both scrolls */
225+
.page-wrapper table thead th:first-child {
226+
z-index: 30;
207227
}
208228

209229
/* Widen the main content area to fill the screen */

0 commit comments

Comments
 (0)