60 lines
1.2 KiB
CSS
60 lines
1.2 KiB
CSS
/* ========== Obsidian 表格扩展样式 ========== */
|
||
/* 来源: https://github.com/Mehraddev/obsidian-custom-table (简化并去除外部字体) */
|
||
/*
|
||
* 使用:在笔记 frontmatter 添加
|
||
* ---
|
||
* cssclasses: wideTable, fixedFc, leftAlign
|
||
* ---
|
||
*
|
||
* 可选 class:
|
||
* - wideTable : 表格占满笔记宽度
|
||
* - fixedFc : 第一列固定窄宽,第二列大字
|
||
* - wideFc : 第一列宽,适合主内容在前
|
||
* - leftAlign : 左对齐
|
||
*/
|
||
|
||
/* 表头默认左对齐 */
|
||
table thead tr th {
|
||
text-align: left;
|
||
}
|
||
|
||
/* 表格占满笔记宽度 */
|
||
.wideTable table {
|
||
min-width: 100%;
|
||
}
|
||
|
||
/* 左对齐 */
|
||
.leftAlign th,
|
||
.leftAlign td {
|
||
text-align: left !important;
|
||
}
|
||
|
||
/* 第一列固定 8em,第二列大字 */
|
||
.fixedFc thead tr th:first-child,
|
||
.fixedFc tbody tr td:first-child {
|
||
width: 8em;
|
||
min-width: 8em;
|
||
max-width: 8em;
|
||
word-break: break-all;
|
||
}
|
||
.fixedFc th:nth-child(2) {
|
||
padding: 9px 20px;
|
||
font-size: 1.2em;
|
||
}
|
||
.fixedFc td:nth-child(2),
|
||
.fixedFc tr > td:last-of-type {
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
max-width: 17em;
|
||
}
|
||
|
||
/* 第一列宽,第二列窄 */
|
||
.wideFc td:nth-child(1),
|
||
.wideFc tr > td:last-of-type {
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
max-width: 36em;
|
||
}
|