Markdown对表格的支持不是很友好,但我们可以通过用CSS来控制,在网上找了很多种办法都是控制整个表格的,不过最终还是找到了一种可以修改各列表格宽度的办法: 在Markdown中加入下列CSS:
<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>
例子
<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 |
一 | 二 | 三 | 四 |
---|---|---|---|
1 | 2 | 3 | 4 |