Hexo 控制 Markdown各列表格宽度

Hexo 控制 Markdown 各列表格宽度

Markdown 对表格的支持不是很友好,但我们可以通过用 CSS 来控制,在网上找了很多种办法都是控制整个表格的。 不过最终还是找到了一种可以修改各列表格宽度的办法.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<style>
table th:nth-of-type(1) {
width: 10%;
}

table th:nth-of-type(2) {
width: 20%;
}

table th:nth-of-type(3) {
width: 30%;
}

table th:nth-of-type(4) {
width: 40%;
}
</style>

举个例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<style>
table th:nth-of-type(1) {
width: 10%;
}
table th:nth-of-type(2) {
width: 20%;
}
table th:nth-of-type(3) {
width: 30%;
}
table th:nth-of-type(4) {
width: 40%;
}
</style>

| 一 | 二 | 三 | 四 |
| :-: | :-: | :-: | :-: |
| 1 | 2 | 3 | 4 |