在编辑《影书单》页面的时候,自动计算出来的 Table 宽度不符合我的审美🤷‍♀️。
所以我找了如何设置 Table 的列的宽度,发现下面这种方法最好用,一步解决烦恼。

代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// table.md

<style>
table th:first-of-type {
width: 10%;
}
table th:nth-of-type(2) {
width: 30%;
}
table th:nth-of-type(3) {
width: 50%;
}
</style>



| a | b | c |
| --------------- | --------------- | --------------- |
| 列宽 = 10% 行宽 | 列宽 = 30% 行宽 | 列宽 = 60% 行宽 |

参考