Files
Pharma-TUMS-1402/.obsidian/snippets/table-style.css

96 lines
2.9 KiB
CSS

/* 1. Make the container scrollable */
.block-language-sheet {
overflow-x: auto !important;
overflow-y: auto !important;
max-width: 100% !important;
max-height: 80vh; /* Adjust this value to change maximum height */
display: block;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
}
/* 2. Prevent the table from squishing (Reverted to original) */
.block-language-sheet table {
width: max-content !important;
min-width: 100%;
border-collapse: collapse;
}
/* 3. Force cells to expand to the longest line (No Text Wrapping) */
.block-language-sheet td,
.block-language-sheet th {
white-space: nowrap !important;
padding: 6px 10px !important;
}
/* 4. Top Header Sticky (Standard Markdown Headers) */
.block-language-sheet th {
position: sticky;
top: 0;
z-index: 10;
background-color: var(--background-secondary) !important;
box-shadow: 0 1px 0 var(--background-modifier-border);
}
/* 5. Custom Row/Col Headers defined by Italics (Sticky Horizontally) */
.block-language-sheet td:has(em),
.block-language-sheet td:has(i),
.block-language-sheet th:has(em),
.block-language-sheet th:has(i) {
position: sticky !important;
left: 0;
z-index: 15;
background-color: var(--background-secondary) !important;
box-shadow: 1px 0 0 var(--background-modifier-border) !important;
}
/* 5.1 Corner Cell Fix: If a Top Header is also an Italic Header */
.block-language-sheet th:has(em),
.block-language-sheet th:has(i) {
z-index: 25 !important; /* Keep it above both horizontal and vertical scrolling */
box-shadow: 1px 1px 0 var(--background-modifier-border) !important;
}
/* 5.2 Style the text inside the italic tags */
.block-language-sheet td em,
.block-language-sheet th em,
.block-language-sheet td i,
.block-language-sheet th i {
font-style: normal !important;
font-size: 110%;
font-weight: bold;
color: var(--text-accent);
}
/* 6. Constant Sticky Footer for the Last Row (Background for empty cells) */
.block-language-sheet tbody tr:last-child td,
.block-language-sheet tbody tr:last-child th {
position: sticky !important;
bottom: 0;
z-index: 10;
background-color: var(--background-secondary) !important;
box-shadow: 0 -1px 0 var(--background-modifier-border) !important;
}
/* 7. Table Name (Last Row, First Cell) - Independent Width & Sticky */
.block-language-sheet tbody tr:last-child td:first-child,
.block-language-sheet tbody tr:last-child th:first-child {
position: sticky !important;
left: 0;
bottom: 0;
z-index: 20;
background-color: var(--background-secondary) !important;
box-shadow: 1px -1px 0 var(--background-modifier-border) !important;
/* Reverted text style */
font-weight: bold;
color: var(--text-accent);
/* MAGIC TRICK: Prevent this cell from stretching the first column */
max-width: 0px !important;
width: 0px !important;
overflow: visible !important;
}